Image "pile" cutting off on edges

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
chowbok
Posts: 5
Joined: 2017-11-09T11:06:58-07:00
Authentication code: 1152

Image "pile" cutting off on edges

Post by chowbok »

I'm using ImageMagick 6.9.9-22 Q16 on Linux. I'm trying to create an image that looks like a pile or stack of images. I'm using a variation of the command found at http://www.imagemagick.org/Usage/thumbnails/#polaroid :

Code: Select all

convert 0195.png \
   -bordercolor none -background none -rotate $(convert null: -format '%[fx:rand()*30-15]' info:) +repage \
   \( 0194.png -bordercolor none -background none -rotate $(convert null: -format '%[fx:rand()*30-15]' info:) +repage \) -gravity center -composite \
   \( 0193.png -bordercolor none -background none -rotate $(convert null: -format '%[fx:rand()*30-15]' info:) +repage \) -gravity center -composite \
   \( 0192.png -bordercolor none -background none -rotate $(convert null: -format '%[fx:rand()*30-15]' info:) +repage \) -gravity center -composite \ 
   +repage -flatten +repage -background black \( +clone -shadow 60x4+4+4 \) +swap -background none -flatten stack.png
This almost does what I want, but it's cutting off the left and right edges and I'm not sure why. How can I change this command so that it makes the resulting canvas as wide as is necessary?
chowbok
Posts: 5
Joined: 2017-11-09T11:06:58-07:00
Authentication code: 1152

Re: Image "pile" cutting off on edges

Post by chowbok »

In case it's relevant: the source images will always have a height of 300px, but the widths will vary.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image "pile" cutting off on edges

Post by snibgo »

Without looking in detail, I notice you "-composite" each image. The output of "-composite" will have the same dimensions as the first input. Is that what you want? If not, perhaps "-layer merge" is more suitable. See http://www.imagemagick.org/script/comma ... php#layers
snibgo's IM pages: im.snibgo.com
chowbok
Posts: 5
Joined: 2017-11-09T11:06:58-07:00
Authentication code: 1152

Re: Image "pile" cutting off on edges

Post by chowbok »

Perfect! (It's -layers, not -layer, though.) Thanks so much!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image "pile" cutting off on edges

Post by snibgo »

Ha, yes, "-layers", sorry.
snibgo's IM pages: im.snibgo.com
Post Reply