NicolasRobidoux wrote:Question: Is it possible to pretend, in IM, that an alpha channel is not an alpha channel, just an extra colour band (almost like CMYK or an image representing separated colour plates, but without cross-over of pseudo-colour bands), and then restore the "last channel is actually an alpha channel" status once this part of the processing is done?
Something like that could be done with a special -channel switch. Somthing like the current special 'Sync' switch.
However your exact suggestion will not work. You can not make alpha channel, alpha effected! As you do for the color channels!
Think about it! It is just plain silly! Alpha must not effect Alpha! You'd get a non-sense result!
In my example what is happening is that color channels (first image) are BOTH alpha effected (alpha was not turned off before distort), and all effects from virtual-pixels also ignored (as they are fully transparent).
However the alpha channel (second image) only ignores VP pixels, as only VP pixels are fully transparent, the rest of the second image is fully-opaque! The results then merged together again.
What we really want is all channels to basically ignore 'virtual-pixels', just as resize does.
That is color channels alpha weighted and VP ignored, and alpha channels just VP ignored.
Implementing this however is difficult and would effectually slow down the filter convolution processing, as you need to test if the pixel value being looked at by the convolution filter, is a VP or not. Basically the underlying sub-routine returning pixels would also then need include that information. Resize does not look up VP pixels, as it is perly a orthogonal process. Distort has to as the lookup points are far less predictable. Also for a normal distort use, such a test is rather useless. It is really only useful for image distortions that go from orthogonal to orthogonal shapes.
No your suggestion would not work. But the solution I provided above would be useful for the implementation of a special -distort-resize type operator. I am sure such an operator could be easily added. The only problem is that it is about 2.5 times slower that a non-alpha distort-resize.
Rememebr distort (convolution) is much heavier in processing than a pixel-by-pixel compose which is why 1/2.