I am trying to stitch together a sequence of images. The first few seem to work fine, but after a couple, bad images appear instead of the specified images. Here are the first several images:

pieces-0.png: enter image description here pieces-1.png: enter image description here pieces-2.png: enter image description here pieces-3.png: enter image description here

I am running the command:

convert pieces-0.png pieces-1.png pieces-2.png pieces-3.png -append pieces-all.png

However, pieces-all.png looks like this:

enter image description here

I’m not sure where the grey pieces are coming from, or why the orange and pink pieces are not shown. Several tutorials and the ImageMagick documentation itself indicate that this should work. What am I doing wrong?

  • The answer posted by lelton is correct but look at your terminology versus what ImageMagick’s terminology. You state you are trying to “stitch together” images, but the command being used is -append which means all images will be appended to each other beginning with the first image… Which is black and white but most likely grayscale. So the command you entered was doing what it was told to do; anything past that requires the -colorspace option to force a colorspace setting as lelton’s answer describes. – JakeGould Sep 2 '15 at 19:21

First you need to identify the colorspace of your images like this:

$ identify -verbose pieces-[0-3].png | grep Colorspace

The output would be something like:

 Colorspace: Gray
 Colorspace: Gray
 Colorspace: sRGB
 Colorspace: sRGB

In your case your the two first one images are using colorspace 'grey', then the Imagemagick sets as a default colorspace on the final conversion.

Finally if you wish to use colors in your the conversion, use the the colorspace of the last two images, final command:

$ convert pieces-[0-3].png -colorspace sRGB -append pieces-all.png

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.