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: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

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 »

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