Convert TIF to PNG with Transparency

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
schille
Posts: 13
Joined: 2017-04-26T07:08:27-07:00
Authentication code: 1151

Convert TIF to PNG with Transparency

Post by schille »

I am trying to convert the tif file (Download URL given below) to PNG. The tif file has a transparent background which turns white after the conversion. I want to preserve the transparency.

Image Magick Version: ImageMagick 7.0.4-6 Q16 x64 2017-01-27 http://www.imagemagick.org
OS: Windows 10 64 bit (x64)

Tif File:
-file was created with Photoshop (Adobe Photoshop CC (Windows))
-file has a completely transparent background
-file has one layer in photoshop
-file has NO Alpha channel (8 bit RGB channels)
-file has a clipping path

The URL to the file:
http://2app.ws/SalusRGB.tif

Command I tried:

Code: Select all

convert SalusRGB.tif[0] Salus.png
Can anyone help me to find a command preserving the transparency in the output image?
schille
Posts: 13
Joined: 2017-04-26T07:08:27-07:00
Authentication code: 1151

Re: Convert TIF to PNG with Transparency

Post by schille »

Another useful info:
Every image viewer i use also removes the transparency of the TIF file and makes the background white.
Only Photoshop shows the transparency of the image.
schille
Posts: 13
Joined: 2017-04-26T07:08:27-07:00
Authentication code: 1151

Re: Convert TIF to PNG with Transparency

Post by schille »

Can anyone help please?

thanks in advance
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert TIF to PNG with Transparency

Post by fmw42 »

Try this. The -size argument is the size of layer 0 from identify -verbose. But layer 0 has white background. Layer 1 is just the bounds of the image and can be composited at its internal offset using -layers merge over a transparent background of the size of the layer 0.

Code: Select all

convert -quiet -size 4724x4724 xc:none SalusRGB.tif[1] -background none -layers merge +repage SalusRGB.png
schille
Posts: 13
Joined: 2017-04-26T07:08:27-07:00
Authentication code: 1151

Re: Convert TIF to PNG with Transparency

Post by schille »

This works, thank you so much!
Post Reply