• 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: Reading RGBA pixel values from image on disk
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading RGBA pixel values from image on disk


  • Subject: Re: Reading RGBA pixel values from image on disk
  • From: Leonardo <email@hidden>
  • Date: Sat, 12 Mar 2011 03:03:31 +0100
  • Thread-topic: Reading RGBA pixel values from image on disk

The tif file preserves the transparency. I can quit re-open with Photoshop
and the transparent pixels are always there. Anyway,
I have found a workaround: I transform the TIF representation to a PNG one:
  pngData = [tifRep representationUsingType:NSPNGFileType
  pngRep = [NSBitmapImageRep imageRepWithData:pngData];
Then I get the right RGBA values. It takes a longer time but it's great.
Thank you to everybody.


Regards
-- Leonardo


> Da: Quincey Morris <email@hidden>
> Data: Thu, 10 Mar 2011 11:07:30 -0800
> A: Leonardo <email@hidden>
> Cc: <email@hidden>
> Oggetto: Re: Reading RGBA pixel values from image on disk
>
> On Mar 10, 2011, at 10:25, Leonardo wrote:
>
>> representations count 1
>> colorSpaceA sRGB IEC61966-2.1 colorspace
>> isPlanar 0
>> numberOfPlanes 1
>> NSAlphaNonpremultipliedBitmapFormat 0
>> hasAlpha 0
>> bitsPPixel 24
>> bytesPerPixel 3
>
> Yes, but what is samplesPerPixel? 3 or 4?
>
>> The pixel I have set on Photoshop as RGBA
>>    0.00, 1.00, 0.00, 0.20
>> becomes in my App as
>>    0.80, 1.00, 0.80, 1.00
>> which clearly means it has been pre-multiplied by a white opaque color
>
> No, if it had been *premultiplied*, the alpha value would still be 0.2. It's
> been *composited* onto a white opaque background.
>
>>    1.00, 1.00, 1.00, 1.00
>> final = (src * 0.2) + (dst * (1.0 - 0.2))
>>
>> I would like to know where the alpha info has gone within the file
>
> It sure looks like Photoshop flattened the file and output it without
> transparency.
>
>


_______________________________________________

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

References: 
 >Re: Reading RGBA pixel values from image on disk (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Book "Cocoa programming for Mac OS X" Third Edition
  • Next by Date: Unique strings array
  • Previous by thread: Re: Reading RGBA pixel values from image on disk
  • Next by thread: Re: Reading RGBA pixel values from image on disk
  • Index(es):
    • Date
    • Thread