Combine 14 images into one

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
jtheg
Posts: 3
Joined: 2013-10-12T16:58:21-07:00
Authentication code: 6789

Combine 14 images into one

Post by jtheg »

Hello,

I have tried finding a solution to this on my own but i cant work it out im really sorry to bother you guys with this,

I have 14 transparent png files that are dynamicly generated,

i want to fetch all of them from their url with imageMagick and combine them into just 1 jpeg image,

I am using the commandline for the imageMagick on a Linux Debian server,

each of the dynamic images are all very small in size,

Thanks in advance,

J.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine 14 images into one

Post by fmw42 »

try (Unix syntax)

convert "http://www.somedomain.com/...image1.png" \
"http://www.somedomain.com/...image2.png" \
...
"http://www.somedomain.com/...image14.png" \
-background whatevercolor -flatten result.jpg

be sure that the path to the files and filenames have no spaces or include the http (url) code for a space %20;

for windows use ^ rather than \ for new line indicator
jtheg
Posts: 3
Joined: 2013-10-12T16:58:21-07:00
Authentication code: 6789

Re: Combine 14 images into one

Post by jtheg »

Thanks for your reply fmw42,

Im still getting used to the unix syntax, Do i just keep putting them like this?,

convert "http://www.somedomain.com/...image1.png" \
"http://www.somedomain.com/...image2.png" \
"http://www.somedomain.com/...image3.png" \
"http://www.somedomain.com/...image4.png" \
"http://www.somedomain.com/...image5.png" \
"http://www.somedomain.com/...image14.png" \
-background whatevercolor -flatten result.jpg

Sorry to be a pain :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine 14 images into one

Post by fmw42 »

Yes. But you can remove all the \ and put them all on one long line if you want.

Of course replace my generic web file paths with your specific ones and pick a background color since jpg does not support transparency.

P.S try just one file and see if it works before you try 14. That way you find out if you have permissions to download from that web site.
jtheg
Posts: 3
Joined: 2013-10-12T16:58:21-07:00
Authentication code: 6789

Re: Combine 14 images into one

Post by jtheg »

I think i sort of have it working,

The images have dynamic parameters after them and i dont think the command line likes it ,

Any ideas?


EDIT: I tried adding quotes around the url but then i get,


error : Unknown IO error
Segmentation fault
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine 14 images into one

Post by fmw42 »

[quote="jtheg"]I think i sort of have it working,

The images have dynamic parameters after them and i dont think the command line likes it ,

Any ideas?


No, not really. I am not sure IM can handle the dynamic parameters in a URL. I suspect it needs a simple URL.

But if you want to provide me a link to one image, I can try to test it myself.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine 14 images into one

Post by snibgo »

URLs with parameters like http://domain/file?param=x often need to be quoted eg "http://domain/file?param=x" in Windows.
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Combine 14 images into one

Post by anthony »

It is likely the security is objecting to the wildcards in the URL.

IM can handle simple URL's but more complex ones are better handled by soemthign like wget.

Hmmm try a bit of shell scrtipting...

Code: Select all

cat  url_list.txt
while read url; do
   wget -q -O - "$url" | convert png:- miff:-
done | convert - -background white -flatten result.jpg
Note I convert the PNG to MIFF format as this is a 'streaming' format. That is you can just concatante images one after the other in the stream and Im will handle reading ALL the images from the stream fine.

There has been a push to try and allow IM to read some image file formats using image streams (such as PNG), and even to just read one image from a stream, while leaving the stream open so another image can be read later by the same (or different) command. That however required the ability to not 'read-ahead' or use 'EOF' to mark the end of an image file (so TXT: images when has not 'end of image' marker in the format is no good for this).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply