Make image border based on other image using trim?

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
coolperez8
Posts: 27
Joined: 2016-03-11T07:27:11-07:00
Authentication code: 1151

Make image border based on other image using trim?

Post by coolperez8 »

I have two images, one is the original image with a border, and the other is an edited version of the image with the border removed using the -trim command. What I want to do is find the trim settings for the original image (assuming that after the trim it will be the same as the edited version.) and reverse apply them to the modified image. I should end up with a version of the modified image using the border that the original image has, properly positioned and everything.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make image border based on other image using trim?

Post by snibgo »

I'm not sure I understand. If you have an image, you can find what it would trim to:

Code: Select all

convert -format %@ info:
The output is in the form WxH+X+Y, which you can use in a "-crop" on the untrimmed image.
snibgo's IM pages: im.snibgo.com
Post Reply