I have a monochrome tiff that I want to resample to a lower resolution.
If I do "convert a.tif -resample 100x100 -monochrome -compress group4" it works as I expect producing a monochrome tiff with group4 compression.
If I do "convert a.tif -monochrome -compress group4 -resample 100x100" it produces a 250+ color tiff with RLE compression. The results are the same for "convert -monochrome -compress group4 a.tif -resample 100x100".
I just read through the command line processing page, and do not see any caveats about ordering other than the types (settings, operators, etc.).
The only thing I can think of is that it does it in the order received. If it resamples last, that would explain why the monochrome and compression isn't sticking. Although in the documentation, it says of those two "An image setting stays in effect until it is reset or the command line terminates" which does not appear to be happening.
Can anyone explain this better or can I consider this a bug?
monochrome, resample, and compress - why does order matter?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
See IM CommandLine Basics
http://www.cit.gu.edu.au/~anthony/graph ... k6/basics/
As of IM v6 (and the reson for the major version change) Im processes all options in command line order. Settings get set, and operators are applied as they are seen.
resampling and image before and after -monochrome will naturally produce VERY different results. Both are operators and are applied immediately they are seen on the command line.
-compress is a setting and is only used by the image save at the end, so it doesn't matter when it is seen, as long as it is before the final save for it to be used
http://www.cit.gu.edu.au/~anthony/graph ... k6/basics/
As of IM v6 (and the reson for the major version change) Im processes all options in command line order. Settings get set, and operators are applied as they are seen.
resampling and image before and after -monochrome will naturally produce VERY different results. Both are operators and are applied immediately they are seen on the command line.
-compress is a setting and is only used by the image save at the end, so it doesn't matter when it is seen, as long as it is before the final save for it to be used
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
First, Anthony, thanks for your web page (which I've referenced numerous times) and for all your posts on the forum.
In the documentation at http://www.imagemagick.org/script/comma ... hp#setting it says that -monochrom is a setting. If this is an operator as you say it is and as I see in practice, then the documentation just needs to be updated to reflect this.
In the documentation at http://www.imagemagick.org/script/comma ... hp#setting it says that -monochrom is a setting. If this is an operator as you say it is and as I see in practice, then the documentation just needs to be updated to reflect this.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Looks like that page has now been updated. Thanks Chrisy.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/