append image from stdin to itself

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
errx
Posts: 4
Joined: 2011-10-27T07:25:00-07:00
Authentication code: 8675308

append image from stdin to itself

Post by errx »

I am receiving image data from stdin and I want to append it to itself without creating temporary files. Is it possible?
Here is the solution with temporary files:
1. save stdin to tmp.file
2. convert tmp.file tmp.file +append result.img
errx
Posts: 4
Joined: 2011-10-27T07:25:00-07:00
Authentication code: 8675308

Re: append image from stdin to itself

Post by errx »

I guess i found the solution:
convert - -clone 0 +append out.gif
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: append image from stdin to itself

Post by anthony »

The -clone should be in parenthesis. The operator is basically designed with parthesis use in mind! If parenthesis is not used you could get different behaviour if you move that 'duplicatation' into parenthesis.

For example...
convert left_image.png \( - -clone 0 \) right_image.png +append line_of_images.png
will produce a different result even though the operations ' - -clone 0 ' have not changed, just put into a "side process"

In IMv7 using -clone outside of parenthesis will likely produce a warning message.

To clone without parenthesis (in newer versions of IM) you use -duplicate
This operator clones images from the same image sequence.
It still generates fast clones of images, but has the added feature of allowing you to make multiple copies of those images.
More importantly it does not require parenthesis for its correctly defined usage.

IM Examples, Basics, Duplicate
http://www.imagemagick.org/Usage/basics/#duplicate
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply