Sunday, March 28, 2010

TIF & JPEG file size increases

Lightroom seems to handle the Import and Export of TIF and JPEG files strangely, and differently to RAW files (in my case, .CRW files from a Canon 300D).



I have LR Import preferences set to reference all files in their current location (as I keep them in folders on a hard drive and never import to LR directly from a camera card), NOT to apply any Develop presets, NOT to generate any Metadata or Keywords, and NOT to Render Standard-Sized Previews. Additionally, under File Management in general Preferences, to put any edits to RAW files in .XMP sidecars. When I Import a RAW file it comes into the Library without affecting the size of the file, and this is so even if you tell LR NOT to put edits in XMP. However, when I Import either a TIF or a JPEG, the file size is increased. For example, a 36,809 KB TIF increases by 6 KB to 36,815 KB and a 579.3 KB JPEG increases by 5.52 KB to 584.82 KB. The resolution of the images does not change, just their file sizes.



Similarly odd file size increases occur with the Export of TIF and JPEG files to which NO edits have been applied, that is, files Exported immediately after Import and without any viewing or editing whatsoever. My Export settings are to use the same file format on export (in the case of JPEG - 100% quality), the same file name and number, same bit depth, same colour space (sRGB - the colour space embedded in the images prior to Import), the same resolution (although setting a different resolution to that generated by the camera or scanner seems to have no effect on output file size) and to Do Nothing after export. Using the files referred to in the Import example above: the TIF increased by a further 14 KB ( 36,815 to 36,829) and the JPEG increased by a futher whopping 1083 KB (584.82 to 1667.82).



It would be much appreciated if someone could shed any light on why this might be happening. I had thought that LR was not supposed to alter a file, at least not until you deliberately sought to process actual edits through the act of exporting the file.
TIF %26 JPEG file size increases
Please don't quote me on this but I seem to recall reading another post a few days ago on this forum where it was said that the 100% setting in LR is different from other Adobe products. You might want to experiment a bit here and output one at say 60% and see if there is any difference. :-)
TIF %26 JPEG file size increases
Thanks Alan for the tip re JPEG quality settings on Export. Now if I can just get some feedback from others, please, regarding the other file size increases on Import for both TIF and JPEG and Export of TIF ?? I suspect that it may have something to do with the fact that when XMP is written to a file, with TIFs and JPEGs it is written into the file itself and not to a sidecar as for RAW files (this info was obtained from the FAQ at Lightroom Extra). However, that would not fully explain the file size increases I have experienced in the circumstances outlined in my original post.


--

Canon EOS 400D (aka. XTi) 鈥?20'' iMac Intel 鈥?12'' PowerBook G4 鈥?OS X 10.4 鈥?LR 1 鈥?PSE 4



Thanks for responding Alexander.

As you will see from my second post in response to Alan, I do appreciate that for Tiffs and Jpegs no sidecars are created and XMP data (which I take to be, and ONLY to be, user-created metadata and/or file edit information) is written directly to the file. However, as you will note from my original post, my Import parameters forbade the creation of any metadata (other than what was originally embedded in the Tiff and Jpeg files, of course) and so I cannot see therefore why the file sizes would increase just by the action of importing them (by reference only, remember) into the Library database. Remember also that before export I performed no edits to the files. Now I can understand re-rendering of Jpegs (which was the subject of Alan's response)and how that would change the exported file size, but that is not applicable to the Tiff example. Tiffs are a lossless file format and, as it happens, my example Tiff was imported without compression and also exported without compression. So there should be no reason for the file size to increase yet further on Export. I am afraid that I still don't have the complete answer just yet. If you or anyone else have any more ideas I would love to hear them.

The miniscule increase in size in a TIFF when imported then exported from LR with no edits, no user included metadata is probably info put in to LR to help keep track of time and state of import, and perhaps some marker to track its location.



Is this change in some way troublesome? You might be able to ''read'' a TIFF with a text editor and compare it side by side with the before image and see what's different in the header area if it's important.

Re John McWilliams,

Thanks for your input John. What you say makes good sense and it is probably correct, with perhaps a couple of qualifications. Last night I tried an Import of my test Tiff (with ''automatically write changes into XMP'' turned ON) and the file size increased in the usual manner. I then did another Import with ''automatically write changes into XMP'' turned OFF and confirmed my previous experience that the file size did NOT increase. I then made a simple White Balance edit (to the second import - the ''OFF'' one) and immediately Exported the file. This time the file size DECREASED by a couple of KB from the original file size. Now if what you say is correct, then it would seem that LR must be removing any additional info it imbedded in the file on Import, and then some additional info, presumably metadata. Now that does disturb me!



Whilst a small size increase is not a problem per se, any file size decrease most certainly is. In either case, however, I want to understand just what is going on. I am nervous when any editing program changes my image files, even where the changes do not affect the pixel resolution. You just can't be sure that the changes will not cause problems in the future with editing programs other than Lightroom.

I could only guess at those changes in file size, but I personally have confidence that your files are safe. Very safe in those formats where LR writes into Maker Notes fields.



If everything in this case is TIFF and remains so, you could export the files so that the edit data is effected- ie. actually converts the pixels, and then you'd have to trust that only the metadata remains intact.

Sorry John, but I cannot understand what you mean in your second paragraph. Could you possibly try to explain it more fully or differently? As I understand the Export/conversion process involved in effecting a White Balance edit, the only thing which changes is the ''value'' of the bytes (not the ''number'' of bytes) representing the colour of each pixel. If that is correct, then any decrease in file size on Export must be due to altered (reduced?) metadata, and so it definitely does not remain intact. This is especially so in the case where the Import is done with ''automatically write changes into XMP'' turned OFF where, as I noted in my last post, the file size does not change after the Import.

I was referring to using Export as in running that command on an image file, specifically a TIFF. It will effect the edits you've done in LR and be saved as a new file that can be displayed by any app that can handle TIFFs and your image edits will be shown (ie, not carried as display commands in LR or PS)



My use of Export regards creating a new file; not just the exporting of metadata to the image file.

In LR speak 'Export' in essence means 'Save as' which takes the info stored as dB metadata and exports it to a real files external to LR. This can be of a number of flavors. TIFF, JPEG, DNG, or PSD and various settings for each.



Don



Don Ricklin, MacBook 1.83Ghz Duo 2 Core running 10.4.9 %26amp; Win XP, Pentax *ist D

http://donricklin.blogspot.com/


John, thanks for the quick reply. I now think that I did understand you after all. However, neither you nor anyone else has really answered my questions with unequivocal explanations. The fact remains that LR produces file size changes, both on Import and Export, for which there is no really satisfactorily consistent reason. I have tried, successfully I think because no one has corrected me, to show that the reasons/opinions previously and generously given by you and others simply do not answer fully the behaviour I am witnessing. That continues to worry me. I am afraid that I do not share your belief that nothing LR is doing could be detrimental. On the contrary, especially where LR reduces the size of a Tiff file on Export, the irresistible inference must be that it is making changes which my ultimately result in the loss/change/corruption of metadata or otherwise prove troublesome. I hope that I am wrong in this but I fear that I am not.

I have a similar question about file size increases. I shoot with an Olympus E1, which produces 10+MB RAW files %26amp; 14 MB TIF files. When I use other applications to process RAW files %26amp; save as TIFs, I get the expected 14MB size. With LR, however, I get 28MB files. What's going on--the file sizes are doubled? This will cause file storage problems much sooner than anticipated.

You see that little ''bit depth'' drop down in export? You probably have it set to 16-bit instead of 8-bit.

Hi Henry,

Your issue is, strictly speaking, not the same as those issues I raised as the subject of this thread. However, I am curious about your file sizes following conversion of RAW to Tiff in LR. In my experience, Raw Converter (RC) programs always increase very considerably the size of the output Tiff file. Dare I admit it, I still use a Canon Digital Rebel (=300D) and on average it produces 7 MB RAW files. On conversion to Tiff in any of Lightroom, Rawshooter Premium or Capture One, the file sizes after conversion are on average: 8 bit Tiff - 18 MB (more than double the RAW size); 16 bit Tiff - 36 Mb (more than 5 times the size of the RAW). What RAW conversion software were you using to turn a 10 MB Oly RAW into only a 14 MB Tiff? If this is not Olympus's own proprietary RC program then I would like to get a copy and try it for myself.

Remember that a RAW image is the actual pixel data. In a Bayer sensor camera (at this point, everything other than a Sigma Foveon camera) there are simply X pixels with 12 bits (in some cameras, 16 bits) of data per pixel, not per channel. The channels (R, G, and B) are derived from that later based on interpolation.



Using the worst case, if the maker uses 2 bytes of storage to store those 12 bits without any compression, then the image data in the RAW file will be 2*X bytes. Without using any compression algorithms, however, the maker can use 1.5 bytes per pixel. That would reduce the image data in the RAW file to 1.5*X bytes. I'm no expert on RAW formats, but I'd guess that a small amount of further lossless compression might be possible, but the nature of camera images, together with the fact that the data is raw, i.e., subject to pixel by pixel color filtering, makes me doubt that lossless compression is feasible at this stage.



Once the image data has been imported to the computer and interpolated to produce RGB data, the file size will grow. If the image is extracted as a 16-bit per channel image, the image data will consume 2*X*3 bytes (six times the number of pixels in the RAW image), while an 8 bit/ch image will be X*3 bytes (three times the number of pixels in the RAW image).

%26gt; Dare I admit it, I still use a Canon Digital Rebel (=300D) and on average it produces 7 MB RAW files. On conversion to Tiff in any of Lightroom, Rawshooter Premium or Capture One, the file sizes after conversion are on average: 8 bit Tiff - 18 MB (more than double the RAW size); 16 bit Tiff - 36 Mb (more than 5 times the size of the RAW).



Yeah. An 8-bit tiff means you are using 8 bits (1 byte) per color per pixel. That's 3 bytes per pixel. The 300D has 3072*2048 pixels. 3072*2048=6,291,456 pixels * 3 bytes/pixel = 18,874,368 bytes = 18 megabytes exactly.



A RAW uses half of that (12 bits per pixel instead of 8*3=24) and is losslessly compressed (like a zip file). Depending on the subject, this will yield a RAW from the 300D that's in the 4-8MB range, typically.

Lee,

Your explanation solved the riddle. The 8-bit tif is about 14 MB. The only two RAW converters I used before LR were Olympus Viewer (came with the camera) %26amp; versions of Paint Shop Pro. Until both of those had the capacity to save in 16-bit formats, their converted TIF files were the same size as if shot in TIF format in the camera. However, I just checked the 16-bit RAW-to-TIF conversions and now these two apps also double the file sizes.



Now for a variation: Is there any advanatage to working at the 16-bit level, given the original native resolution of slightly less than 5 MP for my E1? Frankly, I've never been able to notice a difference. My workflow now basically involves LR for most color adjustments during conversion, then final cropping, resizing, noise reduction (if necessary) and sharpening with PSP XI (a tool I know well and have used since its early shareware days).



Thanks,

HS

%26gt; Now for a variation: Is there any advanatage to working at the 16-bit level, given the original native resolution of slightly less than 5 MP for my E1?



Resolution and bit-depth are independent concepts. 16-bit will help reduce posterization if you are applying significant adjustments like curves.

No comments:

Post a Comment