Convert all colors except black to transparent

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
silversun
Posts: 7
Joined: 2013-09-13T06:59:00-07:00
Authentication code: 6789

Convert all colors except black to transparent

Post by silversun »

I have an app where users are uploading an image of their signature. As would be expected it is not always black on pure white. The background can become grainy and off color depending on the camera/scanner and other factors

Is there a way to tell imagick to make all colors except black transparent. The end goal is to have the signature on a transparent background.

Thank You for the help
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert all colors except black to transparent

Post by snibgo »

snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert all colors except black to transparent

Post by fmw42 »

you might also want to add a -fuzz XX% before +transparent black to adjust the range of near black the is excluded.
silversun
Posts: 7
Joined: 2013-09-13T06:59:00-07:00
Authentication code: 6789

Re: Convert all colors except black to transparent

Post by silversun »

Thank you both!!!

i combined the suggestions and got exactly what I needed!!!!
Post Reply