Page 1 of 1

Odd behavior with "-smush" in IM 7.0.7-0

Posted: 2017-09-08T08:17:03-07:00
by GeeMack
Using ImageMagick 7.0.7-0 Q16 x64 HDRI (or ImageMagick 6.9.8-10 Q16 x64 HDRI) on Windows 10. When I run this command...

Code: Select all

magick -background none -bordercolor none -size 50x50 ^
   xc:red xc:orange xc:yellow xc:none xc:green xc:blue xc:purple +smush 0 smushtest1.png
I get this result...

Image

Apparently the "+smush" operation is pushing the green square over the transparent square and almost entirely covers the yellow, too. Only a single pixel wide column of yellow remains.

By adding a transparent border to each square, the results are similar, but it even pushes the green over that last one pixel column of yellow...

Code: Select all

magick -background none -bordercolor none ^
   -size 50x50 xc:red xc:orange xc:yellow xc:none xc:green xc:blue xc:purple ^
   -border 10 +smush 0 smushtest2.png
Image

This will occur when appending horizontally or vertically with either "+smush" or "-smush".

Re: Odd behavior with "-smush" in IM 7.0.7-0

Posted: 2017-09-08T09:48:08-07:00
by fmw42
I can confirm on IM 6.9.9.12 and IM 7.0.6.0 Q16 Mac OSX. Neither persevere the full width of the transparent square even when adding -alpha on -channel rgba.

Code: Select all

magick -size 50x50 xc:red xc:orange xc:yellow xc:none xc:green xc:blue xc:purple -alpha on -channel rgba -background none +smush 0 smushtest1.png

Re: Odd behavior with "-smush" in IM 7.0.7-0

Posted: 2017-09-08T12:02:56-07:00
by magick
If an image has transparent pixels, the smush offset creates a negative offset, presumably so that images with a transparent background are smushed together. A fully transparent image creates a negative offset equal to the width of the transparent image. So smush is behaving as designed-- but not behaving the way you had hoped. For your use case, use -append instead.