On 24 Feb 2014, at 18:40, David Duncan <david.dun...@apple.com> wrote: > On Feb 24, 2014, at 10:25 AM, Kevin Meaney <k...@yvs.eu.com> wrote: >> I'd already done that, but doing it again made me realize that the problem >> is 100% associated with the alpha channel. Where the pixels are fully opaque >> everything is fine. Where pixels are semi-transparent is where the problem >> occurs. Fully transparent is also fine. I wonder if the problem is to do >> with premultiply. Does TIFF deal with an image generated from a >> premultiplied bitmap properly? > > How are you generating these images? Specifically, the CGImageRef you pass to > CGImageDestination and the pixels backing it. > > PNG does not store premultiplied image data, so the pixels will be > un-multiplied for storage if necessary. TIFF does not seem to have a position > on which form the data takes, but decoders may expect pre-multiplied since > thats what Photoshop writes. > > If your starting image is not pre-multiplied alpha, then the TIFF may be > written the same way but decoded with a pre-multiplied assumption, which > would make the image look horrible.
The image is created from a CGContext RGBA, 8 bits per component. sRGB profile with a bitmap info option of kCGImageAlphaPremultipliedLast. As far as I can tell you can't create a CGContext with an alpha channel that isn't pre-multiplied. I tried creating as few different types with no success. In my coreimage filter, I unpremultiply the color values before calculating the new alpha values which will then be multiplied against the old alpha and then I pre-multiply again before the coreimage kernel filter returns. Kevin _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com