Hi,
I have developed application that uses ffmpeg to generate a thumbnail of a video. If the video has black borders then the black borders are also part of the image. I was wondering if it was possible to clip the black borders from the image using magick. Tried searching on google but could not find anything useful (still looking).
Here is a sample image with black borders
Thanks and Regards
~Sameer
Removing Black Borders from Image
Re: Removing Black Borders from Image
great! thanks for the info.
i was trying to figure out how -fuzz is specified. the doc says distance but couldn't figure out how it is specified.
i was trying to figure out how -fuzz is specified. the doc says distance but couldn't figure out how it is specified.
Re: Removing Black Borders from Image
I think fuzz is a percent so it would be something like this:
Code: Select all
convert image_in -fuzz 20% -trim image_out
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Removing Black Borders from Image
Don't forget the +repage after the -trim if the output is png or gif or tif and not jpgBonzo wrote:I think fuzz is a percent so it would be something like this:Code: Select all
convert image_in -fuzz 20% -trim image_out
see http://www.imagemagick.org/Usage/crop/#trim
P.S. Fuzz values can be absolute graylevel in the range of your compile Q8 (0-255) or Q16 (0-65535), but I find percents easier and more flexible and transportable
Re: Removing Black Borders from Image
This is perfect.
Thanks guys.
Thanks guys.
Re: Removing Black Borders from Image
For reference here's the command i am using:
Command:
convert before.jpg -bordercolor black -border 1x1 -fuzz 20% -trim after.jpg
References:
http://www.imagemagick.org/script/comma ... s.php#trim
http://www.imagemagick.org/Usage/crop/#trim
Regards
~Sameer
Command:
convert before.jpg -bordercolor black -border 1x1 -fuzz 20% -trim after.jpg
References:
http://www.imagemagick.org/script/comma ... s.php#trim
http://www.imagemagick.org/Usage/crop/#trim
Regards
~Sameer