Remove Black Space

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
User avatar
magick
Site Admin
Posts: 11077
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-06-19T07:27:51-07:00

Use -trim to remove borders from your image. Add -fuzz if the border is not of uniform color.

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-06-20T23:26:12-07:00

If you also specifically add a 1 pixel black border to the starting image before using -trim, then you can gurantee that it will only trim black.

This added black border becomes especially important which you also use a -fuzz factor, otherwise you can not be sure what color the color comparision function is comparing against. It may not be pure black
for example.

See IM Examples, for Image Trimming with a specific color.
http://www.cit.gu.edu.au/~anthony/graph ... trim_color
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Post Reply