TSCAmerica.com
TSCAmerica.com

Reputation: 5417

Tiff to PNG adding a white background - Imagemagic

I am using following imagemacgick code to convert TIFF to PNG

convert -profile ISOcoated_v2_eci.icc -profile eciRGB_v2.icc 1.tiff 3.png

TIFF file is at

http://dev9.edisbest.com/images/1.tiff

Converted PNG is AT

http://dev9.edisbest.com/images/3.png

The TIFF has the background white turned off as a layered TIF.

What i want is that the PNG should have a clear background by default, is it possible ?

Upvotes: 0

Views: 591

Answers (1)

TSCAmerica.com
TSCAmerica.com

Reputation: 5417

I figured it out

$route  = "2.tif";
    $salida = '1.png';
    exec("convert $route $salida");
    exec("convert $salida -bordercolor white -border 1x1 \
         -alpha set -channel RGBA -fuzz 10% \
         -fill none -floodfill +0+0 white \
         -shave 1x1 $salida");
    exec("rm $route");

Upvotes: 1

Related Questions