PDA

View Full Version : digital files



Torquemada
4-Dec-2023, 22:29
Im always reading how tiff and png are used to make high quality prints. TIFF is the preferred one from what i see, but mpix only taks jpeg or png.. and i hate jpeg.

BUt can you explain as to why a png conversion can triple the size on disk for a file?

darr
4-Dec-2023, 23:10
Converting to PNG can lead to larger file sizes due to its lossless nature, support for high color depth, and bitmap storage, particularly for images that originally used lossy compression or had lower color depth.

Torquemada
5-Dec-2023, 01:30
but maxed out Nikon NEF raw... is already lossless..

sure cropping an 11x14" image down to 8x10 can reduce the file by 30 MB but i had an old scan of a 35mm negative. the on disk file size of the 5100x3500 pixel image was 18 MB as a jpeg.. but i did an 8x10 crop, and exported as PNG... it went up to 58 MB the numbers are nuts.

sure im using MPIX to do my printing, but god these files..

darr
5-Dec-2023, 08:34
Converting an NEF RAW file to a PNG file can result in a larger PNG file size than the original NEF file for several reasons:

1. Compression Differences: NEF files are typically lossless compressed RAW files. They contain the original sensor data with minimal processing but use compression algorithms that preserve all the image information while reducing file size. PNG files, on the other hand, are typically lossless but use different compression algorithms. These algorithms may not be as efficient as those used in NEF compression, resulting in larger file sizes.

2. Image Format: NEF files are in a format optimized for capturing and preserving raw sensor data. They store pixel values directly from the camera's sensor, which can be more compact than the format used in PNG files. PNG, on the other hand, is a format designed for the storage and display of images and supports additional features like transparency, which may add to the file size.

3. Color Space: NEF files often use a standard color space like Adobe RGB or sRGB. When you convert an NEF file to a PNG, the color information may be stored in a different color space, like RGB or RGBA, which can result in slightly larger file sizes due to the expanded color information.

4. Additional Metadata: PNG files can store additional metadata and text information (such as image title, author, and copyright) as text chunks within the file. This metadata can contribute to a slightly larger file size compared to NEF files, which may have less embedded metadata.

5. File Structure: The internal structure and headers of NEF and PNG files are different. The file headers, metadata, and other file-specific information in each format can vary, contributing to differences in file size.

While NEF files are optimized for raw sensor data storage and use efficient compression algorithms, PNG files are designed for broader image usage and may have larger file sizes due to differences in format, compression, and additional features. The conversion process itself can also introduce subtle changes in the file size, but the primary reason for the increase is the inherent differences between the two file formats.

Hope this helps!

Alan Klein
5-Dec-2023, 13:46
I've noticed with jpeg, if you pick very high number, the final file will be larger in bytes than the original tiff.

Is the process eliminating compression? Why is that happening?

domaz
5-Dec-2023, 15:23
TIFF is famously jokingly called "thousands of image file formats". It's basically a container image format more than a specific format. It can be any bit rate have multiple compression schemes or none (etc). Many programs only support certain incantations of TIFFs and not others. A long time ago I gave up on GIMP because it couldn't support compressed 16-bit gray TIFFs for instance, but Photoshop could. As far as why a PNG would be bigger than a TIFF though- are you sure the TIFF wasn't actually storing things "lossy" in the first place? TIFFs can be lossy or lossless..

Torquemada
5-Dec-2023, 19:01
its somehwat retardd in ways..

ill have to find some of my old 58MB nikon RAW photos and see how they export..

but the digital world is interesting in some ways. And its nice to see some of my old photos and how good they were. And then remember that i was using a different white balance setting, and not using a CPL on everything.. and most of the time just using auto exposure , but switching to manual if i wasnt happy and then using the wheel to under expost by about .5

Corran
6-Dec-2023, 11:55
Many years ago I was auditing a photography course at the university I worked at, mainly as an excuse to use their very large and well-maintained Epson printer. At the same time, an advanced digital photography class was being taught, and the instructor had strict requirements about image files, color space, calibrated monitors, etc. So I used to come in to print and there would be several exasperated students struggling for hours, days, weeks trying to get some semblance of a good print with accurate colors. They would get really angry at me because I would just rock up and start printing from my bog-standard JPG/sRGB files I edited at home and with maybe one test print to dial in any slight color shift I was off to the races.

If you have a very good chain of equipment, process, and etc., perhaps you can realize some advantage with png files or other exotic digital processes, but as I understand it png is more of a standard for raster images / graphics and not photographs. I use it for graphics with transparency. Good JPG images saved on the higher quality side of the compression scheme should be fine for most anything. I just recently printed a 36x24 image from a high-rez 35mm film frame scan and it looks essentially identical to the original tiff scan as far as resolution is concerned.

Graham Patterson
6-Dec-2023, 12:49
TIFF is a strange beast. It is actually a framework for holding one or more versions of the same image in different formats. This was really useful in early desktop publishing where a raster image was used for rapid display, but printing used an embedded Postscript version. There were also optimizations in the format for different processors (big-endian versus little-endian). The trouble is that most applications that handle TIFF are not clear on what they can read from them, or how they write them. So you get TIFF files that are valid but cannot be handled by a different application.

PNG is optimized to compress runs of identical pixels, and can reverse the compression exactly. JPEG is designed to compress photographic images where adjacent pixels are almost certainly different. It does this by working out a mathematical near-equivalent of a small area of the image. This process is not reversible.

Using PNG on photographs often produces a larger file (compared to JPEG) because the compression process has to be reset almost every pixel, introducing overhead.

Jim Andrada
9-Dec-2023, 09:28
Excellent explanation of jpeg compression but it does get into the mathematical weeds a bit.

.

domaz
9-Dec-2023, 14:50
It's also possible to encode PNG's in a lossy manor similar to JPGs, it's not always lossless https://pngquant.org/ Also this may actually be pre-processing to make the PNGs more compressible by strategically losing image detail, but an interesting technique nonetheless.

SergeyT
10-Dec-2023, 22:59
JPEG might be an ok format for storing or transferring of a final version of the image. Not so much for editing as each time a change to the pixels is made and saved the content gets re-compressed using lossy algorithm or , with each edit and save it loses more and more of its original content and becomes repopulated with artificially generated one.

P.S. It is even worse than that. Just opening + saving an image in JPEG (without making any edits) will trigger a re-coding and degradation of the original content. The more repetitions - the more alteration and degradation. Probably the first working implementation of AI in image processing. Andy Warhol could probably have taken advantage of that...

Alan Klein
11-Dec-2023, 09:31
I asked this question earlier. Does anyone have an answer?

I've noticed with jpeg, if you pick very high number (so the compressions is minimum), the final file will be larger in bytes than the original tiff.

Is the process eliminating compression? Why is that happening?

Jim Andrada
11-Dec-2023, 11:46
There is a lossless version of JPEG defined in the standard, but I don't think it's been implemented by anyone. As commonly implemented in most cases the image is divided into 8 x 8 pixel blocks but 16 x 16 and even 32 x 32 blocks are possible.

The big trick with JPEG (etc - it's true of other methods as well) is that some clever folks realized that if you looked at the intensities of a string of pixels you could sort of imagine a continuous curve (ie function in math speak) drawn through the values of each pixel - and it would be kind of wavy and have a fixed frequency and you could maybe apply a lot of what people already knew about waves and signal processing and the mathematical tools and techniques (cheats?) that were already sort of ready to hand and apply them to digital images. In particular ever since an 1822 paper by French gentleman by the name of Fourier we knew that it was possible to mathematically break a complicated wavy looking function (sorry - I meant complicated wavy line) into the sum of a bunch of regular wavy lines of varying frequencies. Now we were off to the mathematical races as we say - since we know that higher frequency signals (like shifts in color intensity and my wife's voice etc) are less perceptible to people and we can now express an image as a series of signals of different frequencies, by golly we could throw away a bunch of these high frequency i(e less perceptible fluctuations) waves and - voilą - we could scrunch these huge images down into smaller ones that still looked damned good. But we've still thrown away data in the quantization step and if we overdo it things will start looking like crap.

(And along the way, somewhere around 1972 IIRC, another clever guy named Ahmed and his academic buddies came up with a way of applying all of this stuff to a string of discrete (ie not continuous) data points and developed the so-called Discrete Cosine Transform which is used in almost all of these compression schemes these days)

Sorry for the rant - this kind of stuff is the bread and butter of many engineering disciplines so the above is not new news - in fact when I got into the CS/IT field in the late 50's, we had a stand alone IBM box that implemented the Fast Fourier Transform - it attached to the I/O channel of a a mainframe and looked from the computer sort of like a tape drive and you could write the input data to it and then read back the transformed data)

I just thought a bit of stuff about what goes on under the hood of these algorithms might help demystify the process a bit for those of us that didn't waste our time in school on STEM stuff like I did (Chem+Physics.)

Jim Andrada
11-Dec-2023, 12:11
I asked this question earlier. Does anyone have an answer?

I've noticed with jpeg, if you pick very high number (so the compressions is minimum), the final file will be larger in bytes than the original tiff.

Is the process eliminating compression? Why is that happening?

There's no such thing as eliminating lossy compression - once information is thrown away, it's REALLY thrown away. It's just taking the recreated (and already somewhat crappier) originally sized version of the image and doing a less effective job of re-crappifyng it than previous iterations have done.

There are tricks one could use to semi- improve things a bit before the re-crappification step but that would be up to Photoshop or whatever you used, not to the JPEG output process. I don't think there's any info carried along that would alert the JPEG process to the fact that this was a previously compressed image.

darr
11-Dec-2023, 13:05
The larger file size with high-quality JPEG settings is due to the preservation of image data and reduced compression, which you've instructed the algorithm to do.

domaz
11-Dec-2023, 13:34
The larger file size with high-quality JPEG settings is due to the preservation of image data and reduced compression, which you've instructed the algorithm to do.

And JPEG has no ability to "fall back" to a lossless compression scheme so it can end up being bigger than a compressed lossless TIFF..

Jim Andrada
11-Dec-2023, 13:40
I don't think many of us ever think about how thoroughly JPEG et al savage our images. First they might muck about with color spaces. then they run the DCT process on each "row" of the block. Then for good measure they run it on each column of the resultant array. Now they have a sort of 2D convolved bunch of 8 x 8 data so they can then make a diagonal scan and string the mashed data (it isn't the pixels we started with anymore folks after it's been through the digestive system twice) - so all the higher frequency sub blocks are all at the end of the newly strung out data. Then they chop off a bunch of the sub blocks just like docking the tail of a doggie. And that's what gets stored. Then when you read it they run the process backwards and rebuild an image that lacks a bunch of info that was in the original. Then when you save it again at lower compression setting they obligingly apply less compression the second time so you could have a larger file with potentially even less info in it.

I always save a TIFF file plus a JPEG file if I want to send it somewhere. I only re-process the JPEG file if absolutely necessary.

By the way, there really isn't any JPEG file format, there's JPEG compressed data in a JFIF file. We just call them JPEG files. Different standards.

Alan Klein
11-Dec-2023, 20:35
Thanks for the info. So, in Lightroom Perpetual 6.14, you can set output jpeg generation quality when you save an image from 0 to 100 with 100 being the highest. What's the best setting?

Peter De Smidt
11-Dec-2023, 20:36
There is no 'best'. There's always a quality versus file size dynamic. The highest quality is 100.

Alan Klein
12-Dec-2023, 05:36
Peter: The problem with anything over setting of 92, the jpeg result is bigger in pixels than the original.

bdkphoto
12-Dec-2023, 07:44
I asked this question earlier. Does anyone have an answer?

I've noticed with jpeg, if you pick very high number (so the compressions is minimum), the final file will be larger in bytes than the original tiff.

Is the process eliminating compression? Why is that happening?


This is not correct - A full size tiff file from my camera (using Lightroom) yeilds a file size of 256MB, saved as a full size jpg in LR at 100 yields a file of 19MB. Significantly smaller.

Peter De Smidt
12-Dec-2023, 07:57
I'm not understanding what the issues are here. For storage (kinda like a negative) always use a lossless format such as Tiff. For specific one-time uses, such as the web, convert a copy to a compressed format such as jpeg. Each venue (Facebook...) will have pixel dimension limits. Specify your pixel dimensions. Now use the highest compression setting (to save file size) that gives you the quality you want. What matters are the results. Try things and figure out what works best for you. That's much more likely to lead to good results than pushing a limited understanding of theory.

Alan Klein
12-Dec-2023, 09:40
This is not correct - A full size tiff file from my camera (using Lightroom) yeilds a file size of 256MB, saved as a full size jpg in LR at 100 yields a file of 19MB. Significantly smaller.

I was figuring against original jpeg size, not tiff. In any case I checked again and I was wrong. At 100% I'm getting around 14.7mb from an original 16.6mb jpeg, so the save is smaller. Interesting, I get exactly the same size at 93% but only 8.8mb at 92%. So what setting would you normally use?

Peter De Smidt
12-Dec-2023, 10:02
Try both. Compare. If one is better, then use it. If not, use the smaller file. In the time this discussion has gone on, you could've easily found out for yourself.

SergeyT
12-Dec-2023, 15:45
Worth keeping in mind that the space on a hard drive or a flash drive is allocated in units (blocks) of a certain size ( 1K, 4K, etc). It means that even for a file size of 1 byte there will be allocated an entire block (1K or more).
The allocation unit size (or block size) is constant and is determined at the time of formatting. Making files smaller does not necessarily translates into more efficient usage of the drive space.
With the current prices and availability of HDD\Flash storage there is no reason to compromise on image quality , or is there? Do we want to go back to the 3MP digital point and shoot era ? :)

Alan Klein
12-Dec-2023, 16:50
Try both. Compare. If one is better, then use it. If not, use the smaller file. In the time this discussion has gone on, you could've easily found out for yourself.

I've set it at 92%. Since the difference between 92% and 93% is 8.8mb vs 14.7MB or almost double, I couldn't believe the smaller one is anywhere near as good as the larger one especially since the original is 16.6mb.. However, I can't see the difference even on similar colored areas. Am I missing anything?

Alan Klein
12-Dec-2023, 16:59
I found this article that explains settings for jpeg quality in Photoshop and Lightroom.
https://photographylife.com/jpeg-compression-levels-in-photoshop-and-lightroom

Jim Andrada
19-Dec-2023, 19:25
Hi Alan. JPEG after all is designed to look good to the human eye. It isn't designed to be edited over and over again. I always think of JPEG compression as something to do after you're finished with editing and just want to send the file to someone. Or put a photo on this website, etc.

wclark5179
24-Dec-2023, 17:53
When in business, all I used for capture was camera RAW, then process the files with bridge, saving as jpg. Lab I used wanted jpg and sRGB color space. Worked just fine for me.