Inserting '-write some.jpg' statement into long command line changes final result
Posted: 2014-11-13T07:29:13-07:00
I'm preparing an ImageMagick workshop aimed to introduce inexperienced IM users to some more advanced techniques. So, I'm trying to demo how one could put '-write intermediate.jpg' in the middle of a long command line in order to...
This works, and 'rainbow1.jpg' indeed displays the expected rainbow colors:
When I insert '-write ...' commands into the same command, like in the following example, the end result changes:
The result looks like a black-red-gradient:
The end-result 'rainbow2.jpg' looks identical -- apart from the 90° rotation -- to the intermediate files 'intermediate-rainbow-colorsp-rgb.jpg' and 'intermediate-rainbow-composite.jpg' (though closer inspection with the help of 'compare' does show a few pixels do differ in between the 3 files).
I'm somehow stunned. I may well have overlooked something very obvious and committed some error. But I don't see it...
Or did I stumble over a bug?
----
This is a MacPorts-based installation on Mac OSX 10.9.5:
P.S.: I also changed output formats to PNG, which didn't make a difference.
- ...inspect intermediate results of the command pipeline;
- ...help understand what happens on a long command line;
- ...provide some sort of "debugging" technique when one constructs one's own commands.
Code: Select all
convert \
-verbose \
-size 30x600 \
xc:"rgb(100%,0%,0%)" \
\
-colorspace hsl \
gradient: \
\
-compose CopyRed \
\
-composite \
\
-colorspace RGB \
-rotate 90 \
rainbow1.jpg
When I insert '-write ...' commands into the same command, like in the following example, the end result changes:
Code: Select all
convert \
-verbose \
-size 30x600 \
xc:"rgb(100%,0%,0%)" \
-write intermediate-xc-red.jpg \
-colorspace hsl \
gradient: \
-write intermediate-colorsp-hsl-gradient.jpg \
-compose CopyRed \
-write intermediate-compose-copyred.jpg \
-composite \
-write intermediate-composite.jpg \
-colorspace RGB \
-write intermediate-colorsp-rgb.jpg \
-rotate 90 \
rainbow2.jpg
The end-result 'rainbow2.jpg' looks identical -- apart from the 90° rotation -- to the intermediate files 'intermediate-rainbow-colorsp-rgb.jpg' and 'intermediate-rainbow-composite.jpg' (though closer inspection with the help of 'compare' does show a few pixels do differ in between the 3 files).
I'm somehow stunned. I may well have overlooked something very obvious and committed some error. But I don't see it...
Or did I stumble over a bug?
----
This is a MacPorts-based installation on Mac OSX 10.9.5:
Code: Select all
$> convert -version
Version: ImageMagick 6.8.9-8 Q16 x86_64 2014-10-03 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib cairo djvu fftw fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib