Page 1 of 1

Converting tif image white background to transparent png file format using image magick

Posted: 2017-09-27T07:05:41-07:00
by venkat2022
I am trying to convert white color backgrounded tif image type to transparent background png image type using below image magick command in alfresco 5.1.

magick convert source_file.tif -fuzz 20% -transparent white converted_file.png

But the above command is not working for all images. For many of images, the foreground color also changing to transparent partially .and for some images, the background is still showing white after conversion also.

please help me of finding a generic imagemagick command which will change only background color without disturbing the image colour .

Note: I tried with multiple fuzz values like 1% to 20% but not at all helping me.

Source image file is a layered image

Re: Converting tif image white background to transparent png file format using image magick

Posted: 2017-09-27T07:32:24-07:00
by snibgo
venkat22 wrote:please help me of finding a generic imagemagick command which will change only background color without disturbing the image colour .
The command will be easy, once you define "background".

Cleary, "nearly white" isn't a good definition for you.

Some people find that "nearly white, and connected by other nearly-white pixels to the top-left corner" is a good definition, so they use a flood-fill.

Re: Converting tif image white background to transparent png file format using image magick

Posted: 2017-09-29T01:23:39-07:00
by venkat2022
Thankyou for your reply snibgo .

Can you provide command if the image background is full white for multi layered tif images ?