Rounding error in -compose subtract
Posted: 2010-04-29T20:11:40-07:00
Hello, I'm trying to use subtract for a research project. It mostly works quite well, the original image is reconstructed perfectly, but in a few spots huge errors manifest - where it seems to create a difference of 255 in one or more channels. In all other cases I've verified that the difference is zero, so it's not going both ways. I tried both miff and png as intermediate images.
Looking closer, the problem only and always occurs when a channel in the second image is 255, it will be zero'd. If you reverse the order of the arguments, it doesn't happen (in my test image, I have no pixels at 255, it's a blur).
Here are the exact commandlines I used to create this:
composite -compose subtract blur_fc.png mini_fc.png subtestc.miff
composite -compose subtract blur_fc.png subtestc.miff subtest_fromc.png
composite -compose difference mini_fc.png subtest_fromc.png subtest_diffc.png
Here's the test images if you'd like to look at it.
Bug?
Looking closer, the problem only and always occurs when a channel in the second image is 255, it will be zero'd. If you reverse the order of the arguments, it doesn't happen (in my test image, I have no pixels at 255, it's a blur).
Here are the exact commandlines I used to create this:
composite -compose subtract blur_fc.png mini_fc.png subtestc.miff
composite -compose subtract blur_fc.png subtestc.miff subtest_fromc.png
composite -compose difference mini_fc.png subtest_fromc.png subtest_diffc.png
Here's the test images if you'd like to look at it.
Bug?