문제

I'm trying to read merged RGBA data from PSD format. "Image data" section contains channels (RGBAA... where first A might be a merged transparency or Alpha mask). Can someone tell me how to know what is stored in first A? I noticed that:

  • when image contains no transparency, but has at least one Alpha mask, then first Alpha channel will contain that alpha mask
  • when image contains transparency, then first Alpha channel will contain merged transparency and other Alpha channels will contain alpha masks

So how do I reliable differentiate between Transparency and Alpha mask in first Alpha channel?

도움이 되었습니까?

해결책

From PSD specification:

Layer count. If it is a negative number, its absolute value is the number of layers and the first alpha channel contains the transparency data for the merged result.

So simple (layerCount < 0) tells me if first A is transparency or Alpha-mask.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top