Hi. I have a question. I have two images, and I need to merged them in one
Let's say 1.jpg and 2.jpg. They are the same dimension/size
So I need to cut the middle of 1.jpg 300x80 size part exactly on the middle of the pic. Take that middle part of 300x80 part from 2.jpg. Merge result in one file/save
Sizes differ. But 1.jpg and 2.jpg always are exactly the same size. AND the part that has to be cropped/replaces is always 300x80 and exactly at the "middle"
can anyone help with exact string/code? Thanks
Crop one image, montage with another
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Crop one image, montage with another
Merged how? One above the other appended? Side by side appended? Lets assume the first. You also do not say what version of Imagemagick nor what platform. Lets assume unix-like system and 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 viewtopic.php?f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
viewtopic.php?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
https://imagemagick.org/script/porting.php#cli
Code: Select all
convert \
\( 1.jpg -gravity center -crop 300x80+0+0 +repage \) \
\( 2.jpg -gravity center -crop 300x80+0+0 +repage \) \
-append \
result.jpg
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 viewtopic.php?f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
viewtopic.php?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
https://imagemagick.org/script/porting.php#cli
Re: Crop one image, montage with another
Unix system
Didn't explain it correctly.
Need to remove 300x80 pxl part in the middle of 1.jpg and replace it with the middle part of 2.jpg
So, the middle of the 2.jpg becomes the middle of 1.jpg
NOT append cropped centers
Didn't explain it correctly.
Need to remove 300x80 pxl part in the middle of 1.jpg and replace it with the middle part of 2.jpg
So, the middle of the 2.jpg becomes the middle of 1.jpg
NOT append cropped centers
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Crop one image, montage with another
Code: Select all
convert \
1.jpg \
\( 2.jpg -gravity center -crop 300x80+0+0 +repage \) \
-gravity center \
-compose over -composite \
result.jpg
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Crop one image, montage with another
The solution offered above by fmw42 is about as simple as it gets. Here's an example of the same concept arranged in a slightly different order...
Code: Select all
convert 2.jpg -gravity center -crop 300x80+0+0 1.jpg +insert -composite result.png