Hi
I am trying to concatenate two images, which have different size (width), with a small gap between them (no border). I try the following:
montage palc3.tif dpac5.tif -geometry +1+0 -tile 2x1 -compress LZW concat.tif
However, the tile command seems to create two cells with the size of the larger image. Thus, there is a lot of space left around the smaller image in the concatenated file, as described in the documentation. What is a good way to get around this?? Earlier someone suggested using splice with convert, but -splice is not recognized by convert?
Sorry to start a new thread about this, but I thought this might be a useful reference.
concatenating images of different size, with gap between,
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: concatenating images of different size, with gap between
Suppose we have:
convert -size 100x100 xc:green g.png
convert -size 30x100 xc:blue b.png
We can put them side-by-side with no gap or border:
convert g.png b.png +append gb.png
We can do this with a 10-pixel red gap:
convert g.png b.png +append -background red -splice 10x0+100+0 gb.png
convert -size 100x100 xc:green g.png
convert -size 30x100 xc:blue b.png
We can put them side-by-side with no gap or border:
convert g.png b.png +append gb.png
We can do this with a 10-pixel red gap:
convert g.png b.png +append -background red -splice 10x0+100+0 gb.png
snibgo's IM pages: im.snibgo.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: concatenating images of different size, with gap between
that requires you to know the size of the first image.snibgo wrote:We can do this with a 10-pixel red gap:
convert g.png b.png +append -background red -splice 10x0+100+0 gb.png
here is one that doesn't. It insearts a small red image, between the two images.
Code: Select all
convert g.png b.png -size 10x10 xc:Red +swap \
-gravity Center -background Red +append gb.png
to prepend some space to ALL the images, then remove the first one from the result.
Code: Select all
convert g.png rose: granite: b.png \
-background Red -splice 10x0+0+0 \
-gravity Center +append \
+gravity -chop 10x0+0+0 gb.png
It looks like the -splice is seeing the -gravity before it was set. Reporting.
This however is working as expected
Code: Select all
convert \( g.png rose: granite: b.png \
-background Red -splice 10x0+0+0 \) \
-gravity Center +append \
+gravity -chop 10x0+0+0 gb.png
bit of read spacing at the end...
Code: Select all
convert \( g.png rose: granite: b.png \
-background Red -splice 10x0+0+0 \) \
-gravity Center +append \
-gravity SouthEast -splice 10x0+0+0 gb.png
first padds out all images to the 'cell' size. then add border around ALL the images
before appending.
That is to say it will add 10 pixels at the sides, and 20 pixels between the images.
For removing spacing from equal sized images see...
Separating Spaced-out Tiling Images
http://www.imagemagick.org/Usage/crop/#crop_spaced
this also explains the difference between the three 'standard' image spacing techniques.
This same technique is also used by a new IM Shell Script, Enlarge Images
http://www.imagemagick.org/Usage/scripts/enlarge_images
whish takes a small image and enlarges each pixel into a square, with space between.
A bit like what you were doing.
Example output is shown at the new IM example...
http://www.imagemagick.org/Usage/convolve/#life
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/