crop black border

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
lele-brz

crop black border

Post by lele-brz »

Hi,
I'm new to ImageMagick, I'm usign this (actually RMagick) to generate thumbnails.
I can do that very easily but I would like to trim black borders (letterbox) if present in the source jpg.
Is there a function for this, or a way to do that?
I could access pixel by pixel and understand where to crop, but I don't know how to do that.
Thanks in advance

bye
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: crop black border

Post by Bonzo »

I do not know about Rmagick but -trim should do it.
http://www.imagemagick.org/script/comma ... s.php#trim
lele-brz

Re: crop black border

Post by lele-brz »

Thanks, I'll try that.
What I don't know is what would happen if I have a black image with just a writing in the center.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: crop black border

Post by anthony »

it will crop the image so the text is all touching the borders of the resulting image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply