Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > TIFF RGBA weirdness

TIFF RGBA weirdness
Thread Tools
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Oct 8, 2001, 02:49 PM
 
I am trying to write an app that will generate alpha values for 24-bit TIFF images and save them to 32-bit RGBA TIFF images. So far I have been able to get just about everything working perfectly but I am noticing some odd behavior when adding noon-100% alpha values. For some reason, everything works perfectly when I add the alpha channel as 100% opacity for every pixel but if I put any less than that it draws the image with the specified opacity but with no RGB colour components (ie, it is a black, but semi-transparent, image).

Does anyone know why this is happening or of a way around this problem?

Thanks,
Jeff.
Spectral Class
"Shedding Light on Innovation"
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Oct 9, 2001, 01:08 PM
 
If you're playing with the bits in the image rep... dunno, sounds like the color values are off. Maybe you're using the wrong scale, or a float is getting converted to an integer without a cast (resulting in 0, though there should usually be a warning somewhere around such code).

If you're using postscript drawing to draw the pixel, which composite operation are you using?
     
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Oct 9, 2001, 10:43 PM
 
An Apple Engineer on the cocoa-dev mailing list helped me out with this so I will post a summary of what he said for anyone interested.

Apparently cocoa pre-multiplies the RGB values based on the given alpha value. To work within this arrangement, the data in the RGB channels of TIFF data must be multiplied by a factor of (alpha/255) before they will appear correctly. This also explains why I was having the earlier problem of black images appearing at less than 255 alpha (the values would wrap-around to 0, ie black, and then have the alpha function applied).

Hope that is of interest and of use,
Jeff.
Spectral Class
"Shedding Light on Innovation"
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:18 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2