Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Here is another example showing that I still don't understand what -set colorspace RGB does. Here adding it before a -threshold causes the channels I'm not operating on to change (very slightly). I don't understand why any processing time is spent on the GB channels and how that relates to colorspace?
Properly (to avoid possible issues) you should add +channel after -separate so that you get only the red channel in each of the 3 channels, since IM 6 does not support 1 channel images. A grayscale image is 3 channels that are all the same.
Second you do not need the second -set colorspace RGB, only the first. The image is already linear from using the first -set colorspace and thus the second one is superfluous, if the processing is done right.
Try these. I have added a -scale 100x20 so that the images can be viewed better. I am using 6.8.3.9 (There have been some grayscale issue that have occurred afterwards that caused the gamma to be set incorrectly, that should finally be cleared up in 6.8.4.7)
My apologies for not being clear. These two examples produce what I expect and are visually identical. Omitting +channel is intentional. It shows that despite working with only the red channel, the BG channels are getting modified by -threshold. The change is slight, but because of the -channel R there should be no processing at all. I agree that the second -set colorspace RGB should be superfluous. In the first case, it does nothing. But in the second case, it halves the processing time (with -size 3000x20000 and output to null:) and changes (or probably stops changing) the results. I don't understand why?
If you only want to process the Red channel you have to leave off -separate and then add +channel at the end so that it turns on the GB channels.
Once you specify -separate, IM takes the one channel and makes it into 3 identical channels.
It does not make sense to me that your second command would work any faster than the first, just because you put -set colorspace RGB before -threshold vs after it. It is just a setting and does nothing itself in terms of pixel processing.
I am not sure why the red difference is 0 and the other two channels are 23. But 23 out 65535 is insignificant.
fmw42 wrote:Second you do not need the second -set colorspace RGB, only the first. The image is already linear from using the first -set colorspace and thus the second one is superfluous, if the processing is done right.
The second -set colorspace RGB, despite being labeled superfluous, is causing an even larger difference in version 6.8.4-8.