Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to append multiple .jpg files into a single large image file containing the result of vertically stacking the single ones. It seems to me that Imagemagick's convert has a somewhat erratic behavior when it comes to -append, i.e vertical wise, when I try to expand a list of files passed as wildcard argument like in the instruction convert -append pg*.jpg out.jpg.

This command creates one output file for every source image there is in the directory. Even then those files aren't concatenations. They are simply copies of the original ones. I would expect one single output with the stacking.

It works just fine using +append, for horizontal stacking. Also works when I type in the name of each individual file, convert -append pg-01.jpg pg-02.jpg pg-03.jpg pg-04.jpg ... output.jpg. The expansion (*) works for a small subset of files, like 7 or 8.

I tried this convert -append `for x in img/pg-*; do echo $x; done;` img/out.jpg in the terminal but I don't know why it doesn't work!

Since I'm working with a bunch of images, I looking to know if there is any alternative for GNU/Linux or why it is behaving like this.

I'll appreciate any info.

Edit: I forgot to mention that I get this error: convert-im6.q16: width or height exceeds limit `pg-01.jpg' @ error/cache.c/OpenPixelCache/3911. when the unexpected output occurs. All images have the same width/height.

question from:https://stackoverflow.com/questions/65836856/concatenate-multiple-images-vertically-using-convert-produces-many-outputs

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

Commenting these lines:

  <policy domain="resource" name="width" value="16KP"/>
  <policy domain="resource" name="height" value="16KP"/>

In /etc/ImageMagick-6/policy.xml appears to have solved the issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...