Hi,

I ran across one texture that I can’t quite figure out how to deal with it 
correctly using TextureSystem. The original texture is a gray scale PNG with 
alpha channel, and I’m converting it with maketx. I’m trying to get that back 
as RGBA via the gray_to_rgb=1 option in the texture cache, but I always get the 
gray channel as R and the alpha channel as G, with B and A empty/default.

I stepped through the code, and I see that in 
TextureSystemImpl::fill_gray_channels(), line 848, the case for two channel 
input files only does the conversion when spec.alpha_channel = 1. When I use 
TIFF for my cache file format, spec.alpha_channel is -1, when I use OpenEXR as 
cache file format, spec.alpha_channel is 0. Maketx apparently only marks TIFF 
as containing an alpha channel when there are 4 or more channels, see 
tiffoutput.cpp line 485. OpenEXR does set the channel name to alpha.

Is there a reason that fill_gray_channels() checks for index of the alpha 
channel rather than just its presence? Is there any way that I can get this 
texture to be read as RGBA through the texture cache?

Thanks,
Stefan
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to