IM 6.5.2-3 Q16 Mac OSX Tiger.
This is not urgent as there is a work around as explained below. But I saw Anthony's note regarding -page going "global" and found a similar situation with -geometry not being respected within parenthesis and going "global".
I was basically trying to make a 100x100 transparent rectangular "hole" at an arbitrary location in an image. The arbitrary location is controlled by -geometry.
# this does not work properly even with -respect-parenthesis
convert -respect-parenthesis \( logo: -resize 50% -negate \) \
\( \( -size 320x240 xc:white \) \( -size 100x100 xc:black \) \
-geometry 100x100+110+70 -compose over -composite -write logo2_tmp4.png \) \
-compose copy_opacity -composite \
logo2_trans4.gif
# fixed by adding +geometry (and even removing -respect-parenthesis)
convert logo: -resize 50% -negate \
\( \( -size 320x240 xc:white \) \( -size 100x100 xc:black \) \
-geometry 100x100+110+70 -compose over -composite -write logo2_tmp5.png \) \
+geometry -compose copy_opacity -composite \
logo2_trans5.gif
potential bug in -geometry going global IM 6.5.2-3
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
potential bug in -geometry going global IM 6.5.2-3
Last edited by fmw42 on 2009-06-02T17:38:37-07:00, edited 1 time in total.
Re: potential but in -geometry going global IM 6.5.2-3
The -geometry option is a legacy option that unfortunately behaves as a setting (e.g. 100x100+10+20) and a resize operator (e.g. 100x100). To support both we associate the geometry with an image as it is encountered on the command line and its stay associated even after the image stack is popped (e.g. end paren). This means you must specifically unassociate a geometry with an image with the +geometry option. If we could get rid of the legacy behavior and only keep -geometry as a setting, the extra +geometry would not be necessary.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: potential but in -geometry going global IM 6.5.2-3
magick wrote:The -geometry option is a legacy option that unfortunately behaves as a setting (e.g. 100x100+10+20) and a resize operator (e.g. 100x100). To support both we associate the geometry with an image as it is encountered on the command line and its stay associated even after the image stack is popped (e.g. end paren). This means you must specifically unassociate a geometry with an image with the +geometry option. If we could get rid of the legacy behavior and only keep -geometry as a setting, the extra +geometry would not be necessary.
OK, thanks for the explanation. Not a problem now that I know one has to use +geometry.
Perhaps if Anthony see this, he can add an example to his extensive notes on composite with geometry to point out this more explicitly and he is welcome to use my example or something like it. I think examples of making a hole in an image would be a useful addition. One can do this with either -draw or composite as per my example.
For those interested, here are these two ways to make a 100x100 hole starting at 110,70 in a negated half size logo image:
convert logo: -resize 50% -negate \
-draw "fill red rectangle 110,70 210,170 fill none matte 160,120 floodfill" \
logo2_trans0.gif
and
convert logo: -resize 50% -negate \
\( \( -size 320x240 xc:white \) \( -size 100x100 xc:black \) \
-geometry 100x100+110+70 -compose over -composite -write logo2_tmp5.png \) \
+geometry -compose copy_opacity -composite \
logo2_trans5.gif