Convert from tiff to png not working fine

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?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert from tiff to png not working fine

Post by fmw42 »

It is not polite to provide large images with a slow download site. Nevertheless after waiting a long time for the download, I find that all 4 images look the same except for the names. The command I gave previously works fine on all 4 images. Did you even try that?

Code: Select all

convert -quiet image.tif -alpha transparent -clip -alpha opaque -strip image.png
rokadeaks
Posts: 13
Joined: 2018-02-12T10:33:20-07:00
Authentication code: 1152

Re: Convert from tiff to png not working fine

Post by rokadeaks »

Hi,
I have another tif image for which with your specified command I am getting wrong image.
https://ufile.io/slcy3

Can you please provide generic command which will work for all 5 images.
Thank you
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert from tiff to png not working fine

Post by fmw42 »

Your image has 3 layers, each with an alpha channel and a clip path. You have to choose whether you want the clip path or the alpha channel and which layer you want. I do not know which you want and neither would ImageMagick.

The following works for me to get the clip path of the first layer.

Code: Select all

convert -quiet image.tif[0] -alpha transparent -clip -alpha opaque -strip image.png
The following works for me to get the alpha channel of the first layer.

Code: Select all

convert -quiet image.tif[0] -strip image.png
rokadeaks
Posts: 13
Joined: 2018-02-12T10:33:20-07:00
Authentication code: 1152

Re: Convert from tiff to png not working fine

Post by rokadeaks »

Hey sorry for late reply, And thanks for command.

btw 'convert -quiet image.tif[0] -alpha transparent -clip -alpha opaque -strip image.png'

command provided by you is working fine for most of the images but if image have Paths then seems it not working.
here is link for images
https://ufile.io/v53xi

For above images I removed paths using photoshop then with command provided by you I am getting correct image.

How can we do using command , generic command which will work for all 4 towel images & images in above link.

Thanks for help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert from tiff to png not working fine

Post by fmw42 »

I am not aware of any one unique method that will handle all cases. You could test for clip paths and alpha channels and then choose one or the other method. You could do this all with a short script, which would be OS dependent.
rokadeaks
Posts: 13
Joined: 2018-02-12T10:33:20-07:00
Authentication code: 1152

Re: Convert from tiff to png not working fine

Post by rokadeaks »

Ok thanks i will try
Post Reply