Re: exporting image files to disk using CGImageDestination
Re: exporting image files to disk using CGImageDestination
- Subject: Re: exporting image files to disk using CGImageDestination
- From: David Duncan <email@hidden>
- Date: Mon, 24 Feb 2014 10:40:58 -0800
On Feb 24, 2014, at 10:25 AM, Kevin Meaney <email@hidden> wrote:
>
> On 24 Feb 2014, at 18:04, Bill Dudney <email@hidden> wrote:
>>
>> Make sure that what you are looking at is what you think you are looking at. When you look at it in Preview is it being scaled? If so then the default scaling algorithm in Preview for TIFF might be 'fast but ugly’ (I don’t know, just guessing). With a PNG it might be choosing a ‘nice but slower’ algorithm.
>>
>> My recommendation would be to ensure you are looking at the image unscaled as both PNG and TIFF. In Preview I think the menu item is ‘Show Full Size’ or something like that.
>
> 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.
>
>> If the docs are vague it would help to file a bug (http://bugreporter.apple.com) to make sure the people in charge of those docs get your input.
>
> I wrote a bug report ages ago relating to the ImageIO documentation when I had the same problem understanding the settings when creating gif animations using CGImageDestination. I've not had any response to that bug report.
>
> Thanks for the help.
> 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
--
David Duncan
_______________________________________________
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