Need help converting PNG to TIFF [Solved]

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

msledge
Posts: 3
Joined: Mon Nov 14, 2022 1:33 am

Need help converting PNG to TIFF [Solved]

Post 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.
cday
XnThusiast
Posts: 3481
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Need help converting PNG to TIFF

Post 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:
njpdlstar
Posts: 1
Joined: Wed Nov 16, 2022 12:08 am
Location: New Jersey

Re: Need help converting PNG to TIFF

Post by njpdlstar »

cday wrote: Mon Nov 14, 2022 7:45 am
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:
It worked for me. cday, thank you.
msledge
Posts: 3
Joined: Mon Nov 14, 2022 1:33 am

Re: Need help converting PNG to TIFF

Post 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_command_used.PNG
You do not have the required permissions to view the files attached to this post.
cday
XnThusiast
Posts: 3481
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Need help converting PNG to TIFF

Post 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?
cday
XnThusiast
Posts: 3481
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Need help converting PNG to TIFF

Post 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.tif

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)
You do not have the required permissions to view the files attached to this post.
msledge
Posts: 3
Joined: Mon Nov 14, 2022 1:33 am

Re: Need help converting PNG to TIFF

Post 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.
User avatar
XnTriq
Moderator & Librarian
Posts: 6138
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Need help converting PNG to TIFF

Post 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.
cday
XnThusiast
Posts: 3481
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Need help converting PNG to TIFF

Post 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!
User avatar
XnTriq
Moderator & Librarian
Posts: 6138
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Need help converting PNG to TIFF

Post 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!