• 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: Avoiding color transformations in PNG/UIImage/CGImage ops?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoiding color transformations in PNG/UIImage/CGImage ops?


  • Subject: Re: Avoiding color transformations in PNG/UIImage/CGImage ops?
  • From: Rick Mann <email@hidden>
  • Date: Thu, 16 Nov 2017 19:29:28 -0800

OpenCV is not relevant in this case, that was just background that I probably
didn't need to include.

I'm generating an image buffer, saving it as PNG through UIImage, then
generating it again, and comparing it to the UIImage bytes I get by opening the
previously-saved image. I'm not specifying anything other than device RGB color
space when I create the CGBitmapContext I use to generate the image buffer.

> On Nov 16, 2017, at 19:27 , Alex Zavatone <email@hidden> wrote:
>
> Before looking into OCV, my wild guess is that it may have to do with the
> colorspace of the image.  What are you setting it to? Profile Name: sRGB
> IEC61966-2.1?
>
>
>> On Nov 16, 2017, at 8:31 PM, Rick Mann <email@hidden> wrote:
>>
>> I'm trying to write a unit test for some code I wrote that generates one
>> image from another. In the main app, the source data comes from Open CV as a
>> buffer of 3 byte-per-pixel elements. My code generates a CGImage. In the
>> unit test, I load a saved version of one of those images from a PNG file to
>> UIImage, get at the buffer, pass it to my code, and then compare the result
>> to a saved version of that same output.
>>
>> The saved version is a PNG. I load that, and then get the data buffer using
>>
>>   let fiData = fi.dataProvider?.data as Data?
>>
>> I do a similar thing with the generated CGImage. Then I compare the two
>> buffers, byte by byte. They are similar, but contain differences (sometimes
>> more than I would expect). But if I save both as PNG and look at them in
>> Preview they look identical.
>>
>> My guess is something's happening somewhere with color correction. In my
>> code, I make a CG(bitmap)Context, specifying device RGB color space (should
>> that be generic?). I don't really know what happens to the PNGs I save and
>> load.
>>
>> Is there a way to ensure the bytes in the buffer are compressed and
>> decompressed exactly as written?
>>
>> --
>> Rick Mann
>> email@hidden
>>
>>
>> _______________________________________________
>>
>> 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
>


--
Rick Mann
email@hidden


_______________________________________________

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: Avoiding color transformations in PNG/UIImage/CGImage ops?
      • From: Alex Zavatone <email@hidden>
References: 
 >Avoiding color transformations in PNG/UIImage/CGImage ops? (From: Rick Mann <email@hidden>)
 >Re: Avoiding color transformations in PNG/UIImage/CGImage ops? (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Avoiding color transformations in PNG/UIImage/CGImage ops?
  • Next by Date: Re: Avoiding color transformations in PNG/UIImage/CGImage ops?
  • Previous by thread: Re: Avoiding color transformations in PNG/UIImage/CGImage ops?
  • Next by thread: Re: Avoiding color transformations in PNG/UIImage/CGImage ops?
  • Index(es):
    • Date
    • Thread