• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: exporting image files to disk using CGImageDestination
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exporting image files to disk using CGImageDestination


  • Subject: Re: exporting image files to disk using CGImageDestination
  • From: Kevin Meaney <email@hidden>
  • Date: Mon, 24 Feb 2014 18:59:35 +0000

On 24 Feb 2014, at 18:40, David Duncan <email@hidden> wrote:
> On Feb 24, 2014, at 10:25 AM, Kevin Meaney <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: exporting image files to disk using CGImageDestination
      • From: Kevin Meaney <email@hidden>
References: 
 >Re: exporting image files to disk using CGImageDestination (From: Kevin Meaney <email@hidden>)
 >Re: exporting image files to disk using CGImageDestination (From: David Duncan <email@hidden>)

  • Prev by Date: Re: exporting image files to disk using CGImageDestination
  • Next by Date: Re: NSNumber : method to return pointer to represented value
  • Previous by thread: Re: exporting image files to disk using CGImageDestination
  • Next by thread: Re: exporting image files to disk using CGImageDestination
  • Index(es):
    • Date
    • Thread