PAID: trim edges and merge 2 PNG into a layout

Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.
Locked
jpcpizo
Posts: 3
Joined: 2020-01-31T04:35:20-07:00
Authentication code: 1152

PAID: trim edges and merge 2 PNG into a layout

Post by jpcpizo »

Hello, I need a command line / script to trim the edges of 2 PNG images, and fit both of then into a new PNG.

The new PNG should be the size of 68mm (H) x 200 mm (W) and 400 DPI.

Both images should are designs that I will use in mug production later, so each one could not be bigger than 68mm (H) x 68mm (W).

Here is an example of what I need:

1. I have those 2 png images:
Image
https://imgur.com/Z252eM6

and

Image
http://imgur.com/3UzaF3w

and they need to be trimmed and fitted into a single PNG like that:

Image
http://imgur.com/V0jh7FC

The image above, the fist design is 68x68mm in size, as the limiting dimension was the height. But the second image is 68x53mm as the limiting dimension was the weight.

I'm a newbie using image magick, so i preatty much don't know how to properly use this tool.

Thank you in advance!

Joao

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

Re: PAID: trim edges and merge 2 PNG into a layout

Post by fmw42 »

ImageMagick does not work in units of mm. It works in pixels. So you have to convert your mm dimensions to pixels using your density.

Your desired dimensions are 200x68 mm (WxH). The conversion is:

400 dpi * 200 mm / 25.4 mm per in
and
400 dpi * 68 mm / 25.4 mm per in

or

400*200/25.4 = 3150 px
and
400*68/25.4 = 1071 px

So the command would be in Unix syntax on ImageMagick 6:

Code: Select all

convert -size 3150x1071 xc:none \
\( left.png -trim +repage -resize 1071x1071 \) -gravity west -composite \
\( right.png -trim +repage -resize 1071x1071 \) -gravity east -composite \
left_right_banner.png
Image

If using Imagmagick 7, change convert to magick

Please always provide your ImageMagick version and platform/OS when asking questions here, since syntax may vary.

jpcpizo
Posts: 3
Joined: 2020-01-31T04:35:20-07:00
Authentication code: 1152

Re: PAID: trim edges and merge 2 PNG into a layout

Post by jpcpizo »

Hello, I'm using imagemagick 7.0 and windows 10.

I belive the sintax it's a little different right?

thank you in advance.

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

Re: PAID: trim edges and merge 2 PNG into a layout

Post by fmw42 »

On Windows and IM 7 it would be

Code: Select all

magick -size 3150x1071 xc:none ^
( left.png -trim +repage -resize 1071x1071 ) -gravity west -composite ^
( right.png -trim +repage -resize 1071x1071 ) -gravity east -composite %
left_right_banner.png

jpcpizo
Posts: 3
Joined: 2020-01-31T04:35:20-07:00
Authentication code: 1152

Re: PAID: trim edges and merge 2 PNG into a layout

Post by jpcpizo »

Yes! that's it. Worked Perfectly, thank you alot.

Should I pay you? please DM me.

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

Re: PAID: trim edges and merge 2 PNG into a layout

Post by fmw42 »

No, not necessary.

Locked