Page 1 of 1
trim set of images same amount
Posted: 2015-12-10T20:19:50-07:00
by utnuc
I've got a set of stills extracted from a video that I'd like to process the same way, but when I apply -trim to each still they are getting trimmed a tad different each time (when they should have the exact amount of black space on every still. Is there a way to get the average trim of a set and apply it to each one? Here's my code:
Code: Select all
convert in.png -trim +repage out.png
Re: trim set of images same amount
Posted: 2015-12-10T20:50:27-07:00
by fmw42
try
Code: Select all
cd to directory of images
convert * -format "%@" info:
See
http://www.imagemagick.org/script/escape.php
You can then process all the data to get the average width, height, xoffset and yoffset and then use -crop WxH+X+Y +repage, but it depends upon your OS for scripting.
Please always provide your IM version and platform when asking questions to save a lot of back and forth questions and answers.
Re: trim set of images same amount
Posted: 2015-12-11T08:16:31-07:00
by utnuc
this worked brilliantly with a little bash scripting. Thanks fmw42!