Concating 2 little filters in one line

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
olagato

Concating 2 little filters in one line

Post by olagato »

Hi, I'm newbie with ImageMagik (version 6.3.8-q16):

I'm working with "Windows XP Command Line" and 2 images to compose a watermark (foto.jpg and logo.png)
I have 2 separate filters that works fine:

a) composite logo.png -resize 50% foto.jpg -compose Multiply -gravity southeast output.jpg
b) convert foto.jpg -mattecolor Tomato -frame 10x10+5+5 output.jpg

Basically I want to merge the 2 images for a watermark and add a border to the output image:
Filter a) make the watermarked image
Filter b) make bordered image

I'm trying to merge both filters in one command line but I dont know how. I have tried the use of parenthesis and arrays without success.
Any ideas ?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Concating 2 little filters in one line

Post by anthony »

Next time ask this in 'Users Forum' and read the 'before posting' topic.

Code: Select all

convert  foto.jpg \
        \( logo.png -resize 50% +clone +swap \
            -gravity SouthEast -compose Multiply -composite \
            -write output1.jpg  +delete \) \
        -mattecolor Tomato -frame 10x10+5+5 output2.jpg
Which does the following (line by line)...
  • read first image
  • start a new sequence, read and resize overlay, get copy of the first image, and swap there positions (background image first)
  • set up gravity and composition and compose the to images
  • write out that first result, then delete it before closing the now empty sub-sequence
  • frame the original first image and write that as the final (second) result.
See IM Examples, Basics (parenthesis, delete, swap), and File Handling (writing). for more details.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Concating 2 little filters in one line

Post by fmw42 »

This seemed to work for me, if I understand what you are trying:

convert lena.png \( logo: -resize 100x100! \) -gravity southeast \
-compose multiply -composite -mattecolor Tomato -frame 10x10+5+5 tmp.png

So I would think that the following would work for you:

convert foto.jpg \( logo: -resize 50% \) -gravity southeast \
-compose multiply -composite -mattecolor Tomato -frame 10x10+5+5 output.jpg
olagato

Re: Concating 2 little filters in one line

Post by olagato »

Solved !!!

Thank you very much Anthony and Fmw42:
Anthony's solution generated 2 separated images but I need only 1 image as result.
Fmw42's post works fine copying and pasting next sentence in Windows' command line:

convert foto.jpg ( logo.png -resize 50% ) -gravity southeast -compose Multiply -composite -mattecolor Tomato -frame 10x10+5+5 output.jpg
Post Reply