Merging pictures with optional resizing (command line)

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
MBGod
Posts: 2
Joined: 2018-10-02T09:09:31-07:00
Authentication code: 1152

Merging pictures with optional resizing (command line)

Post by MBGod »

Hello and thank you for your attention.
What i have:
pic1.jpg , pic2.jpg, pic3.jpg height and width vary but is always proportional to 1920*1080, ratio 16:9
Watermark.png always 1920*1080

What i would like is to watermak picA.jpg with picB.png, but before merging both of pictures, resizing piB.png at the same size than picA.jpg
Thank you for your help.

Command
for %f in (*.jpg) do composite -dissolve 70% Watermark.png %f %f

Pictures
https://photos.app.goo.gl/ztJw4U7MJUnP7ehx8
Last edited by MBGod on 2018-10-03T03:20:26-07:00, edited 2 times in total.
ImageMagick-7.0.8-12-Q16-x64-dll on WIN 10 user
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Merging pictures with optional resizing (command line)

Post by fmw42 »

You would need to check the size of picA and then resize picB to that size before doing the watermarking. This can be done easily in one command in IM 7, but is more complex in IM 6.


Please, always provide your IM version and platform when asking questions, since syntax may differ.

Also provide your exact command line and your images, if possible.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
MBGod
Posts: 2
Joined: 2018-10-02T09:09:31-07:00
Authentication code: 1152

Re: Merging pictures with optional resizing (command line)

Post by MBGod »

@fmw42 Thank you and sorry, post updated
ImageMagick-7.0.8-12-Q16-x64-dll on WIN 10 user
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Merging pictures with optional resizing (command line)

Post by fmw42 »

Here is my suggested command for IM 7 on Windows

Code: Select all

magick PairiDaiza1.jpg -set option:dims "%wx%h" ( Watermark.png -resize "%[dims]" ) -compose over -composite result.jpg
See
https://imagemagick.org/Usage/basics/#set
https://imagemagick.org/Usage/basics/#parenthesis
https://imagemagick.org/Usage/compose/#compose
Post Reply