i can not trim this kind of image

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 »

Try adding -fuzz 15% to your command line. Fuzz permits close colors to match along with your target color.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

The fuzz option won't help with this image. If you magnify it with an image viewer you will find that there is a margin along the top and left sides of the image that is two pixels wide consisting of various shades of grey pixels.

This is a screen grab of the top left corner of the image (I used Paint Shop Pro).
http://members.shaw.ca/saskbirder/newsletter_mag.png

I think trim will work if you first crop that margin out of the image.

Best Wishes
Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

You could also try -trim twice (e.g. -fuzz 15% -trim -trim).
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

I've played a bit with cropping and trimming that image and the margins are a bit more awkward than I thought.
In order for trim to work you have to crop a two pixel margin off the top, 5 pixels off the left margin and 5 off the bottom margin and then trim (with a fuzz of 15) reduces the image to 899x2269 from its original 982x4000.

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

Post by anthony »

for more information on -trim see
http://www.cit.gu.edu.au/~anthony/graph ... crop/#trim

This includes fuzzy trims, trims with a specific color, and trim ignoring small features.

If anyone likes to add other techniques, please mail me.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply