Page 1 of 1

implode region in IM 7

Posted: 2019-10-05T12:09:30-07:00
by dognose
Not sure if this is a bug or if changes in implode or how region works in IM 7

Any idea on what's going on or how to fix?

flower.jpg
Image

convert -region '150x150+50+50' -implode 1 flower.jpg out.jpg
IM 6 out.jpg (desired)
Image

magick flower.jpg -region '150x150+50+50' -implode 1 out.jpg
IM 7 out.jpg ( notice box effect)
Image

Re: implode region in IM 7

Posted: 2019-10-05T15:39:27-07:00
by magick
See https://imagemagick.org/script/porting.php:
-region: This option sets a write mask for the region you define. In IMv6, a separate image was cloned instead, operated on, and the results were composited to the source image. In addition, the draw transformations are relative to the upper left corner of the image, previously in IMv6 they were relative to the region.

Re: implode region in IM 7

Posted: 2019-10-05T17:30:52-07:00
by fmw42
Thanks. Is there a workaround other than compositing with a mask image?

Re: implode region in IM 7

Posted: 2019-10-05T17:57:08-07:00
by magick
Sure, you can clone the image, operate on it and composite the results back to the source image. This is exactly what IMv6 does, -region was simply a convenience to do all the operations with one -region option.

Re: implode region in IM 7

Posted: 2019-10-05T18:22:13-07:00
by fmw42
These are equivalent. (Note proper IM syntax -- read the input first)

Code: Select all

convert flower.jpg -region '150x150+50+50' -implode 1 +region out.jpg

Code: Select all

convert flower.jpg \
\( -clone 0 -crop '150x150+50+50' +repage -implode 1 \) \
-geometry +50+50 -composite result6.jpg

Code: Select all

magick flower.jpg \
\( -clone 0 -crop '150x150+50+50' +repage -implode 1 \) \
-geometry +50+50 -composite result7.jpg

Re: implode region in IM 7

Posted: 2019-10-06T06:06:50-07:00
by dognose
Thanks so much!