Quickly merging 2 select files side by side through windows context menu?

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?".
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Quickly merging 2 select files side by side through windows context menu?

Post by snibgo »

"+append" appends horizontally. "-append" appends vertically. You would adjust the width instead of the height:

Code: Select all

-resize "%%[fx:max(u.w,v.w)]x"
The "-resize" normally takes two numbers, like 23x34. for width and height. You are supplying only one, so IM calculates the other.
snibgo's IM pages: im.snibgo.com
ericpa06
Posts: 11
Joined: 2018-02-06T17:09:02-07:00
Authentication code: 1152

Re: Quickly merging 2 select files side by side through windows context menu?

Post by ericpa06 »

snibgo wrote: 2018-02-06T22:36:51-07:00 "+append" appends horizontally. "-append" appends vertically. You would adjust the width instead of the height:

Code: Select all

-resize "%%[fx:max(u.w,v.w)]x"
The "-resize" normally takes two numbers, like 23x34. for width and height. You are supplying only one, so IM calculates the other.
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Quickly merging 2 select files side by side through windows context menu?

Post by fmw42 »

Is there a question here?
ericpa06
Posts: 11
Joined: 2018-02-06T17:09:02-07:00
Authentication code: 1152

Re: Quickly merging 2 select files side by side through windows context menu?

Post by ericpa06 »

fmw42 wrote: 2018-02-07T09:50:34-07:00 Is there a question here?
Ok, since you asked.. I'm trying to not abuse of you guy's patience but... would it be possible to automatically, instead of just merging them and keeping their original height or width, to create a new image with a height and width already defined, and to merge them side by side in it?

To be more clear and to explain me better, I would selecte two images, and to create a new image with them side by side and split in half, with resolution of, let's say "1000X400", and I would like to centralize each image inside its respective square/parts?

Something like this:
Image

Instead of this:
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Quickly merging 2 select files side by side through windows context menu?

Post by fmw42 »

That is possible, but it means cropping one or both images to fit the half width. I presume you mean that the appended image is to be 1000X400? Is that correct?

Try this:

Code: Select all

convert image1.jpg image2.jpg -resize "500x400^" -gravity center -crop 500x400+0+0 +repage -bordercolor white -border 2 +append result.jpg
or

Code: Select all

convert image1.jpg image2.jpg -resize "500x400^" -gravity center -extent 500x400 -bordercolor white -border 2 +append result.jpg
Change the names of the images for your purposes.

See
https://www.imagemagick.org/script/comm ... p#geometry
https://www.imagemagick.org/Usage/thumbnails/#cut
ericpa06
Posts: 11
Joined: 2018-02-06T17:09:02-07:00
Authentication code: 1152

Re: Quickly merging 2 select files side by side through windows context menu?

Post by ericpa06 »

Thank you so much, it worked perfectly!
ericpa06
Posts: 11
Joined: 2018-02-06T17:09:02-07:00
Authentication code: 1152

Re: Quickly merging 2 select files side by side through windows context menu?

Post by ericpa06 »

So... that first script, would it be possible to make it to merge two gif files side by side?

"magick %1 %2 -resize "x%%[fx:max(v.h,u.h)]" +append file.png"

I tried to twerk it a little bit (like changing the command to ".gif"), but it ended up combining all the images inside each gif side by side, instead of something like this:

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

Re: Quickly merging 2 select files side by side through windows context menu?

Post by fmw42 »

Snibgo's method may have trouble if the number of frames and frame delays are different. See https://www.imagemagick.org/Usage/anim_mods/#merging
Post Reply