Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
valen wrote: ↑2017-06-15T08:02:54-07:00
The first image (grayscale, no alpha) prints out 512 pixel values. This is because ImageMagick reads 2 channels from it. Why 2? I don't know. All the values it prints out are 35. I assume this is a gamma adjusted value based on the original 50 we used.
You have 2 channels. One is the value of the red channel (RedPixelChannel) and the other value is (IndexPixelChannel). To know which value is which you should call the .offset method of the Pixels class. I am guessing that the colormap that is created contains values where the index has the same value as it's value.
valen wrote: ↑2017-06-15T08:02:54-07:00
The second image (grayscale, yes alpha) prints out 768 pixel values. This is because ImageMagick reads 3 channels from it. Why 3? I don't know. The values print out in a repeating pattern "186, 255, 186". Over and over again until all 768 are printed, that pattern repeats. I assume the 186 is a gamma adjusted value based on the original 200 we used. I don't know where the 255 came from. And notice the actual grayscale values of 50 (or adjusted 35) are nowhere to be found!!!??
You have 3 channels. One is the value of the red channel (RedPixelChannel), one is the alpha channel (AlphaPixelChannel) and the other value is (IndexPixelChannel). To know which value is which you should call the .offset method of the Pixels class. The 255 value is the value of the alpha channel. And I think you are not getting 35 because the alpha is blended into the red channel. This would explain why the alpha channel is fully opaque.