Question re converting TGA to TIF

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, xnview

Post Reply
grafical
Posts: 28
Joined: Sat Apr 21, 2012 3:08 pm

Question re converting TGA to TIF

Post by grafical » Wed Feb 19, 2014 6:24 pm

I need to batch convert a folder of TGAs to TIF format, and will need to repeat the process, so I'm creating a Batch Processing script which I can reuse. In the Formar dropdown, I've selected: "TIF - TIFF Revision 6" as the output format.

I notice that when I click "Options" there is a "JPEG QUALITY" setting. I've tried setting that field to 100 and then saving the script, but when I reopen it, it's been reset to 80 again. Does this setting have any bearing when converting from TGA to TIF format? Will I be getting a perfect 1:1 conversion from the source TGA to output TIF? Since both formats are uncompressed, I presume the result should be a perfect pixel-to-pixel match except for file type.. Is that correct?

graf

cday
XnThusiast
Posts: 2320
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Question re converting TGA to TIF

Post by cday » Wed Feb 19, 2014 6:42 pm

grafical wrote:I need to batch convert a folder of TGAs to TIF format... when I click "Options" there is a "JPEG QUALITY" setting. Does this setting have any bearing when converting from TGA to TIF format?
TIFF is in general a lossless image format but the JPEG compression option, like the JPEG file format, is lossy...

If file size isn't important you could save to TIFF with LZW compression or any other option except JPEG and maintain perfect image quality.

grafical
Posts: 28
Joined: Sat Apr 21, 2012 3:08 pm

Re: Question re converting TGA to TIF

Post by grafical » Wed Feb 19, 2014 7:57 pm

I'm sorry, I still don't understand why a "JPEG Quality" option exists in a TGA to TIF conversion in the first place. Are you saying that by enabling LZW compression, I'm automatically disabling the JPEG Quality setting, and at the same time preserving 100% quality from the TGA to TIF? When I select LZW Binary Compression the JPEG Quality setting doesn't get grayed out or anything suggestive of it being disabled...

What I need is an exact conversion from TGA to TIF, while preserving 100% image quality, regardless of file size. It's a 50MB image.. I don't care how large it is as long as it's 100% pixel-to-pixel identical to the original TGA, where every single pixel in the resulting TIF will have identical RGB values to the corresponding pixel in the source TGA.

EDIT: I just did a conversion on a 4096x4096 TGA to TIF as a test.. The first test I let the JPEG Quality setting remain at 80. The second output was JPEG Quality setting at 100, and the third test was LZW Binary Compression. I then compared all 3 files in WinMerge on Windows and Meld on Linux and all 3 show up as identical. So it suggests that none of those settings in the TIF Write Options in the batch processing dialog actually have any effect.. I'd really like to hear from a dev to clarify this question though, because either the settings don't actually do anything and I'm getting the exact same output file no matter what settings I select, or I'm missing something in the process...

graf

cday
XnThusiast
Posts: 2320
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Question re converting TGA to TIF

Post by cday » Wed Feb 19, 2014 8:32 pm

grafical wrote: I still don't understand why a "JPEG Quality" option exists in a TGA to TIF conversion in the first place.
The TIFF 6 format provides a selection of alternative compression methods: the JPEG option when used enables much smaller files to be created although with some potential loss of quality, as in the JPEG image format. The TIFF format can contain multiple images -- a large number -- in a single file and so a TIFF with JPEG compression may sometimes be a useful format.
grafical wrote:Are you saying that by enabling LZW compression, I'm automatically disabling the JPEG Quality setting ... When I select LZW Binary Compression the JPEG Quality setting doesn't get grayed out or anything suggestive of it being disabled...
Yes, the JPEG quality setting shouldn't be displayed for other compression methods; that is confusing and has been raised recently, and is an open issue at the moment.
grafical wrote:What I need is an exact conversion from TGA to TIF, while preserving 100% image quality, regardless of file size ... I don't care how large it is as long as it's 100% pixel-to-pixel identical to the original TGA, where every single pixel in the resulting TIF will have identical RGB values to the corresponding pixel in the source TGA.
Then you can use TIFF with any compression method except JPEG...

You're not concerned about file size, but if you were it would be worth testing alternative compression methods as the optimum compression that can be obtained may depend on characteristics of the image, such as the presence of large areas of the same colour.

grafical
Posts: 28
Joined: Sat Apr 21, 2012 3:08 pm

Re: Question re converting TGA to TIF

Post by grafical » Wed Feb 19, 2014 9:06 pm

Not sure if you saw the edit I added, but after doing those 3 tests, all 3 files were binary-identical, and I should have also mentioned, all 3 were exact same filesize as well which, I guess, follows from the fact that they were binary identical.. but yes.. regardless of JPEG 80, JPEG 100, or Binary LZW, all 3 resulting files were identical.

graf

cday
XnThusiast
Posts: 2320
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Question re converting TGA to TIF

Post by cday » Wed Feb 19, 2014 9:14 pm

The displayed JPEG quality setting will only affect the file size when saving to TIFF with JPEG compression option selected...

Are we saying the same thing now? Your TIFFs were large, much larger than with the JPEG option selected, even with a high quality setting?

If you select TIFF with the LZW option selected there will be no doubt that the resulting image is identical to your orignal image.

grafical
Posts: 28
Joined: Sat Apr 21, 2012 3:08 pm

Re: Question re converting TGA to TIF

Post by grafical » Wed Feb 19, 2014 9:36 pm

The displayed JPEG quality setting will only affect the file size when saving to TIFF with JPEG compression option selected...
Well, the JPEG Quality setting isn't really an on or off setting.. it's just there... so it's impossible to tell if it's actually being used or not, because file size alone is not an indicator (see below)
Are we saying the same thing now? Your TIFFs were large, much larger than with the JPEG option selected, even with a high quality setting?
No :) What I'm saying is that my resulting TIFs were *always* 50MB, regardless of JPEG 80, JPEG 100, or Binary LZW.

The source TGAs are also 50MB, and I believe that with these 2 file formats the file size is directly related to dimensions.. i.e. a 512x512px TGA or TIF is *always* 760K.. a 1024x1024 is *always* 3MB... a 2048x2048 is *always* 12.5MB, and so on...

graf

cday
XnThusiast
Posts: 2320
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Question re converting TGA to TIF

Post by cday » Wed Feb 19, 2014 10:05 pm

TIFF_1.png
With the above settings the TIFF file created will be uncompressed whether the original file is colour, grayscale or 'binary' (black and white)...
TIFF_2.png
With the above settings the TIFF file created will be LZW compressed whether the orignal file is colour, grayscale or 'binary' (black and white)...
TIFF_3.png
The JPEG quality setting (in practice) only has an effect when 'JPEG' is displayed in the 'Colour' window -- it's not an option for black and white because the format only supports colour and grayscale.

I realise it's confusing and that's why there is a pending request to hide the 'Quality' window when JPEG compression is not selected... (@xnview... )

grafical
Posts: 28
Joined: Sat Apr 21, 2012 3:08 pm

Re: Question re converting TGA to TIF

Post by grafical » Wed Feb 19, 2014 10:45 pm

Ok, so if I had None and None selected for the two drop-downs, I was by default converting without any JPEG compression at all. That's good to know because I was contemplating having to reprocess several thousand images!

graf

Post Reply