LZW Compression - Image rendition advice
This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
LZW Compression - Image rendition advice | Ralph Zerbonia | 22 Jan 17:15 |
LZW Compression - Image rendition advice | Chris Mohler | 22 Jan 18:04 |
LZW Compression - Image rendition advice | Jay Smith | 22 Jan 20:19 |
LZW Compression - Image rendition advice | Chris Mohler | 22 Jan 21:52 |
LZW Compression - Image rendition advice
According to all the literature, when saving a .tif file, LZW Compression is lossless. My project involves many large scans of individual items. I can scan several at once and then I use Gimp to cut and paste the individual items to their own file (Copy-paste-save as). They are themselves very large files, some as much as 800mb. I'd like to use LZW as it appears to compress these files to where they are about 60% of the non-lzw file size. My question is whether or not anyone knows of any image disadvantages, is there anything about LZW that would allow a loss of any visual fidelity? These scans are important because they are able to be viewed down to the pixel level and such close examination of the scanned objects is part of an ongoing research project, so any loss of what can be seen, or anything which would cause false artifacts in the image are to be avoided. Anyone have any thoughts in this regard?
LZW Compression - Image rendition advice
On Sat, Jan 22, 2011 at 11:15 AM, Ralph Zerbonia wrote:
My question is whether or not anyone knows of any image disadvantages, is there anything about LZW that would allow a loss of any visual fidelity?
LZW is indeed lossless. I just did a quick test[0] to be sure that GIMP's implementation is lossless and it turned out OK[1].
PNG is a lossless format as well, and may give a slightly smaller file size than TIFF.
Chris
[0] I did the following in GIMP 2.6.10:
- Open an uncompressed TIFF file
- Save a copy with LZW
- Close all files
- Open original
- Open As Layers LZW copy
- Change LZW layer mode to "Difference"
- Move the cursor about in the image while looking in the 'Pointer' dialog
- All RGB values are 0% (black) throughout the image
(could also flatten the image at this point and use levels or curves
to verify that there are no anomalies)
[1] In an older version of Photoshop (5? 6?) I did the above and came out with a very slight "shift" or "loss". It could have been a mistake on my part, but at the time we figured it was a bug in Adobe's LZW handling. I can't reproduce this any more in Photoshop - so whether or not it was pilot error or a bug, it's no longer relevant - except it's the reason I remember the above procedure ;)
LZW Compression - Image rendition advice
On 01/22/2011 01:04 PM, Chris Mohler wrote:
On Sat, Jan 22, 2011 at 11:15 AM, Ralph Zerbonia wrote:
My question is whether or not anyone knows of any image disadvantages, is there anything about LZW that would allow a loss of any visual fidelity?
LZW is indeed lossless. I just did a quick test[0] to be sure that GIMP's implementation is lossless and it turned out OK[1].
PNG is a lossless format as well, and may give a slightly smaller file size than TIFF.
Chris
[0] I did the following in GIMP 2.6.10: - Open an uncompressed TIFF file
- Save a copy with LZW
- Close all files
- Open original
- Open As Layers LZW copy
- Change LZW layer mode to "Difference" - Move the cursor about in the image while looking in the 'Pointer' dialog - All RGB values are 0% (black) throughout the image (could also flatten the image at this point and use levels or curves to verify that there are no anomalies)[1] In an older version of Photoshop (5? 6?) I did the above and came out with a very slight "shift" or "loss". It could have been a mistake on my part, but at the time we figured it was a bug in Adobe's LZW handling. I can't reproduce this any more in Photoshop - so whether or not it was pilot error or a bug, it's no longer relevant - except it's the reason I remember the above procedure ;)
I have always wondered about this. Thanks, Chris for the information.
However, a couple related questions about LZW-compressed TIFF files....
a) For images under (for example) 50 MB in size, and on systems that are modern, fast, and with lots of memory, is there an approximate rule of thumb regarding how much longer opening and saving operations will take?
b) (Though not a Gimp issue) Are there any implications using LZW-compressed TIFF images in other applications? Specifically, I use Perl scripts and ImageMagick to create four different sizes of JPEGs from each TIFF file. Do such operations care whether or not a TIFF file has been LZW compressed?
c) Other than saving disk space and/or reducing file transmission time in the case of uploading/downloading, are there any particular reasons to use (or not to use) LZW compression?
Jay
LZW Compression - Image rendition advice
On Sat, Jan 22, 2011 at 2:19 PM, Jay Smith wrote:
a) For images under (for example) 50 MB in size, and on systems that are modern, fast, and with lots of memory, is there an approximate rule of thumb regarding how much longer opening and saving operations will take?
I've never benchmarked this - I'm sure there is some performance hit, but not sure how much.
b) (Though not a Gimp issue) Are there any implications using LZW-compressed TIFF images in other applications? Specifically, I use Perl scripts and ImageMagick to create four different sizes of JPEGs from each TIFF file. Do such operations care whether or not a TIFF file has been LZW compressed?
Since the LZW patent wars are finally over I would not expect any problems reading/writing LZW compression. I've never had any LZW issues with ImageMagick.
c) Other than saving disk space and/or reducing file transmission time in the case of uploading/downloading, are there any particular reasons to use (or not to use) LZW compression?
As far as I see it (and I'm no expert, just someone who has some experience with various printing methods) it's a trade-off between file size and processing. I use LZW for most TIFFs, but if - hypothetically - you had a massive amount of very small TIFF files that needed lots of read/write operations done on them, you might look at running some benchmarks.
I just scanned the Wikipedia entry on TIFF and it seems pretty accurate to me (again no expert here). Although I had no idea that the third and fourth bytes equal 42 "for its deep philosophical significance" ;)
My 0.02,
Chris