Page 1 of 1

Need help converting PNG to TIFF [Solved]

Posted: Mon Nov 14, 2022 1:36 am
by msledge
I am very new to this. I don't understand anything about the details of images - I just need to write a simple command line to convert PNG to TIFF. I have been able to do that with this NConvert - however, the background in the converted file is blank, and the original is white.

Is there an easy way to help me understand what parameters I need to set in order to achieve that?

Last thing - I was looking for a way to convert the image to grayscale and I have not found that. Can you help me?

thank you.

Re: Need help converting PNG to TIFF

Posted: Mon Nov 14, 2022 7:45 am
by cday
msledge wrote: Mon Nov 14, 2022 1:36 am I don't understand anything about the details of images - I just need to write a simple command line to convert PNG to TIFF. I have been able to do that with NConvert - however, the background in the converted file is blank, and the original is white.
If you search online for "TIFF transparency" without quotes, I think you will find as I have just done that the TIFF format does not directly support transparency, although there may be some at least partial workarounds...

I was looking for a way to convert the image to grayscale and I have not found that. Can you help me?
I believe this is the relevant option:

Code: Select all

-grey num         : Convert in Grey Scale (256, 128, 64, 32, 16, 8 or 4)
The use of 'Grey Scale' rather than 'greyscale' or 'grayscale' makes that option harder than it might be to find... :wink:

Re: Need help converting PNG to TIFF

Posted: Wed Nov 16, 2022 5:08 am
by msledge
Hello - and thank you for your quick response. And I must apologize in advance because I mistyped my question / request. the converted tiff has a 'black' background - not 'blank'. I'm attaching the before and after files. The original is a PNG. The converted is a TIF. Lastly - I'm attaching the NConvert command I used.
nconvert_tiff_converted.PNG
nconvert_png_original.PNG
nconvert_png_original.PNG (21.33 KiB) Viewed 3096 times
nconvert_command_used.PNG

Re: Need help converting PNG to TIFF

Posted: Wed Nov 16, 2022 8:12 am
by cday
Your image nconvert_png_original.PNG saves directly to a TIFF with a white background in XnView MP, I don't know why that isn't the case with your NConvert code above...

Pierre?

Re: Need help converting PNG to TIFF

Posted: Thu Nov 17, 2022 8:24 am
by cday
I have now tested your source file and code using NConvert 7.99, and the output is a TIFF image with a white background:

Code: Select all

nconvert  -out tiff  png_original.png
png_original.PNG
png_original.PNG (21.33 KiB) Viewed 3063 times

png_original.tif
(314.51 KiB) Downloaded 56 times

My test was a quick test in Windows 10, which I hate, but I believe that it was valid.

Note:

If you are unable to reproduce that result, you might very speculatively test whether either of the following options could be needed in you code, possibly a default setting is different in your current installation??

Code: Select all

 -bgcolor red green blue: Background color (for rotate/canvas)
 -bgcolor2 red green blue alpha: Background color (for rotate/canvas)

Re: Need help converting PNG to TIFF

Posted: Thu Nov 17, 2022 1:53 pm
by msledge
Hello. Thank you for the quick response. I have now confirmed that the .png files do have a transparent background. I confirmed this because I moved the original .png to my local pc (which has a dark background) and the background was in fact black. There was not an issue using the converter.

Thank you for all of your help. I apologize that I did not make that connection earlier - and as you mentioned, no direct support for Transparency - which is fine because the actual files I will be receiving to convert would not have transparency. I was just testing on all kinds of files to determine if the program worked for my needs.

Thank you again.

Re: Need help converting PNG to TIFF

Posted: Thu Nov 17, 2022 8:15 pm
by XnTriq
cday wrote: Mon Nov 14, 2022 7:45 amIf you search online for "TIFF transparency" without quotes, I think you will find as I have just done that the TIFF format does not directly support transparency, although there may be some at least partial workarounds...
TIFF is widely used by professionals, and it has always supported transparency.
https://en.wikipedia.org/wiki/Transparency_(graphic) wrote:Raster file formats that support transparency include GIF, PNG, BMP, TIFF, TGA and JPEG 2000, through either a transparent color or an alpha channel.

Re: Need help converting PNG to TIFF

Posted: Thu Nov 17, 2022 8:47 pm
by cday
XnTriq wrote: Thu Nov 17, 2022 8:15 pm
cday wrote: Mon Nov 14, 2022 7:45 amIf you search online for "TIFF transparency" without quotes, I think you will find as I have just done that the TIFF format does not directly support transparency, although there may be some at least partial workarounds...
TIFF is widely used by professionals, and it has always supported transparency.
I stand corrected, my quick look at the results of the search I made on a hunch evidently was too quick!

Re: Need help converting PNG to TIFF

Posted: Thu Nov 17, 2022 9:15 pm
by XnTriq
cday wrote: Thu Nov 17, 2022 8:47 pmI stand corrected, my quick look at the results of the search I made on a hunch evidently was too quick!
Lot's of misleading info out there!