Trimming montage-d images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
whugemann
Posts: 310
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Trimming montage-d images

Post by whugemann »

When doing a montage with some distance between the individual images, one gets a white border surrounding the montage image. With IM 6 I used to get rid of this white border by piping it to convert and using either -trim or -shave, i.e.

Code: Select all

montage rose: rose: rose: rose: -tile 2x2 -geometry x+8+8 :- | convert - -trim 1.jpg
as I couldn't directly use the option

Code: Select all

-trim
with montage. (I am using Windows).

The documentation (https://imagemagick.org/script/montage.php) says that with IM 7, montage now has a -trim option, thus I tried

Code: Select all

magick montage rose: rose: rose: rose: -tile 2x2 -geometry x+8+8 -trim  2.jpg
which did not shave off the white border. Furthermore,

Code: Select all

magick montage rose: rose: rose: rose: -tile 2x2 -geometry x+8+8 :- | magick - -trim 3.jpg
does not work anymore. Am I missing some point or is this a bug in IM 7?
Wolfgang Hugemann

snibgo
Posts: 12686
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trimming montage-d images

Post by snibgo »

wrote:magick montage rose: rose: rose: rose: -tile 2x2 -geometry x+8+8 :- | magick - -trim 3.jpg
Your output ":-" is bad. You have a colon with no format. Either omit the colon "-" or include a format "PNG:-".
I know nothing about "-trim" with montage. That may be a bug.
snibgo's IM pages: im.snibgo.com

User avatar
whugemann
Posts: 310
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Trimming montage-d images

Post by whugemann »

So far I thought that ":-" defaults to miff.
But you are right: When using "png:-", "miff:-" or just "-", piping works correctly with IM 7.
Wolfgang Hugemann

snibgo
Posts: 12686
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trimming montage-d images

Post by snibgo »

On "-trim" in montage: an experiment shows that this trims each input before the montage is done, not the output.
snibgo's IM pages: im.snibgo.com

Post Reply