Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

formula for photo size

Aug 29, 2006 3:51AM PDT

I am wondering why two JPG photos of same dimensions (600*800) get different file size (172KB, 72KB).

I think there should be a standard formula.

I tried to calulate the file size of the two photos by:
(600*800*?)/8=172KB
(600*800*?)/8=72KB

The unknown value should be the same, right? otherwise
how could the PC knows how big a photo file size is?

Discussion is locked

- Collapse -
It depends on how much compression is used when the
Aug 29, 2006 5:14AM PDT

jpeg is created. As compression increases (more data thrown away), the file size decreases.

- Collapse -
Also.....
Aug 29, 2006 5:38AM PDT

Also....complex images will not compress as much as a simple image.

A simple image is one with fewer surfaces, such as one with lots of blue sky.

A complex image will have lots of surfaces, such as tree leaves, nearby blades of grass, bricks or shingles on a building, etc, etc.

There is no formula.

...
..
.

- Collapse -
Jpeg is a lossy format
Aug 29, 2006 9:09AM PDT

as KP and snapshot2 points out... compression and the amount of detail in the photo adds up to the file size for a jpeg picture. RAW files along with some other formats take up more room but lose less detail or none at all.

Compression comes in two forms: lossless and lossy. Lossless compression loses none of the image information during compression and decompression. Lossy compression as its name says removes some of the original photographic detail. Lossy compression can reduce the size of image files to a far greater extent than lossless compression.

grim

- Collapse -
No formula
Aug 29, 2006 5:29PM PDT

Try an experiment:
Create two pictures of 800x600 pixel dimensions.
One being a single color, the other being multi colors, as random as you can make it (I used a fractal pattern).
Save both as JPG images.

Then look at the sizes.
In my experiment I found that the single color picture was under 4k bytes, and the multi-colored picture was over 181k bytes.

Any guess why? because JPG compression, actually any compression, can compress a repeating pattern MUCH MORE than a non-repeating pattern.

Now, use those same two pictures and now save them as 24 bit color BMP (bitmap).
In my test I found that BOTH images saved as 1407k bytes.

One last test. Again take those same images and now save them as 8 bit color BMP images.
In my test, then BOTH images were saved as 470k bytes.

Notice that in BMP images, regardless of the colors and patterns, the size of the resultant file depends upon the pixel dimensions, and the color depth.
The formula would be H*W*D (Height * Width * Depth)

Not so with JPG. Hence, there can be no 'standard formula' for JPG.

OH, one last point. Remember I mentioned that any compression program can compress repeating patterns better than non-repeating patterns? I then took the two 1407k byte BMP images (one a single color, the other a very random color pattern) and zipped them both.
The single color BMP compressed to about 2k bytes, whereas the multi-colored one only compressed to 1379k bytes. Not much savings there, huh.

- Collapse -
woo..
Aug 29, 2006 6:18PM PDT

many thanks for your explanation and the experiments.

HappyHappy

- Collapse -
No Formula
Aug 31, 2006 3:22PM PDT

Good info Chuck.

-Kevin

- Collapse -
Are the photos exactly the same?
Aug 29, 2006 8:35PM PDT

Same amount of detail and colores? Both saved with the same quality setting? Does one have EXIF data the other does not? How were they saved and from what program?

- Collapse -
EXIF?
Aug 30, 2006 3:48AM PDT

I am sorry!
I need help on the definition of EXIF.
What does it stand for?

- Collapse -
Just guessing, but it's probably something like
Aug 30, 2006 4:35AM PDT

EXposure Information File. Date, time, camera, lense, etc.

- Collapse -
EXIF = EXchangeable Image Format
Aug 30, 2006 5:54AM PDT

Here is the information I read from Answers.com:
''EXIF
(EXchangeable Image Format) Extensions to image file formats that hold the camera settings used to take the picture. Developed in 1995 by JEIDA focr JPEG images, EXIF data was added to TIFF, RAW and other formats later. Most digital cameras support EXIF and save the data in the file headers. However, when an image is edited, the EXIF data may be automatically removed by the software. An EXIF reader is a utility that is used to read, display and save EXIF data from a file.
''

If you use some image reader or viewer that has the ability to display (maybe even edit) the meta-data (the somewhat hidden data inside the picture format - NOT in the image itself) you will see information like this, (and perhaps even more!):
Make - OLYMPUS OPTICAL CO.,LTD
Model - C740UZ
Orientation - Top left
XResolution - 72
YResolution - 72
ResolutionUnit - Inch
Software - Jasc
DateTime - 2003:07:09 16:21:11
YCbCrPositioning - Co-Sited
ExifOffset - 550
ExposureTime - 1/40 seconds
FNumber - 3.70
ExposureProgram - Aperture priority
ISOSpeedRatings - 100
ExifVersion - 0220
DateTimeOriginal - 2003:07:08 18:40:08
DateTimeDigitized - 2003:07:08 18:40:08
ComponentsConfiguration - YCbCr
CompressedBitsPerPixel - 2 (bits/pixel)
ExposureBiasValue - 0.00
MaxApertureValue - F 3.73
MeteringMode - Multi-segment
LightSource - Auto
Flash - Not fired, compulsory flash mode
FocalLength - 63.00 mm
UserComment -
FlashPixVersion - 0100
ColorSpace - sRGB
ExifImageWidth - 2048
ExifImageHeight - 1536
InteroperabilityOffset - 1268
FileSource - DSC - Digital still camera
SceneType - A directly photographed image
CustomRendered - Normal process
ExposureMode - Auto
WhiteBalance - Auto
DigitalZoomRatio - 0.00 x
SceneCaptureType - Standard
GainControl - Low gain up
Contrast - Normal
Saturation - Normal
Sharpness - Normal
Maker Note (Vendor): -
Mode - 1504 (1504)
JpegQual - Super
Macro - Off
DigiZoom - 1.00 x
Software Release - SX754
PictInfo - [pictureInfo] Resolution=1 [Camera Info] Type=SX754
CameraID - OLYMPUS DIGITAL CAMERA

- Collapse -
Exactly, and that metadata takes up space...
Aug 30, 2006 9:13PM PDT

sometimes quite a lot of it. In Photoshop if you take an image from a camera and Save As jpg you will get a significantly different file size than if you Save for Web, which strips out all Exif.

Some people need the metadata, and some don't need/want it.

- Collapse -
Metadata doesn't take that much space
Aug 31, 2006 5:24AM PDT

The EXIF metadata does not take up nearly the room your would think. I just check the photo that had all that information and that area of the file was less than 4k bytes. The reason it can take less space than you might think is because the areas of the hex data are defined, and the title of each field does not appear in the data, just the value of the field.
For example, the one line reading "CompressedBitsPerPixel - 2 (bits/pixel)" will not be found in the metadata, but the value "2" is there, in a particular defined area.

In Photoshop, there is the ability to additionally store a preview of the image, which could be a quite useful or embarrassing image (ask Cat Schwartz, read here: http://hutta.com/catcrop/). I would suppose that by using a "Save for Web" function would probably strip off not just EXIF data, but the even more space taking of the preview, and perhaps even the IPTC and the possible Comment data.

IPTC and Comment? Yes, there are other areas that can be quite detailed and lengthy, also taking up space in the metadata area. But those manually entered areas are not used by most people. Usually they are used by professional photographers to help in photo identification.

- Collapse -
EdH
Aug 31, 2006 3:32PM PDT

I seem to recall that every time you save a JPG file to any size or rename it, the compression starts to deteriorate the original image.
Why not save it as a tiff, PSD or EPS right off the bat and save the integrity of the original file.
Ed, what about RAW? I am not used to raw files.
Also please explain some more on metadata for me.
Thanks,

-Kevin

- Collapse -
Meta data...
Sep 1, 2006 2:10AM PDT
is information that can be embedded in an electronic image with most software programs used to edit photos. The information stays with the image and can be accessed by others who use programs that read IPTC. Most digital cameras support IPTC data.


think of exif information as the name and date written on the back of a physical photograph... add the expeosure settings, type of camera used, etc. and you have just about any relevant information saved that you might need later when manipulating a digital image.

Use EXIF as a learning tool

Many digital camera owners study EXIF to compare successful photos to those that are not. The data provides insights about how camera settings affect photo characteristics such as exposure, depth-of-field and subject movement.


Meta data is essentially hidden/embedded information in a digital document such as a picture to a web page. Meta data is what web engines such as Google previously used to help rank importance/relevance of web pages when a search was done. Web masters found they could repeat a key word thousands of times in the meta data and skew search results... consequently it has become less important in the web search process.

RAW file format

A RAW image file is often referred to as a true digital negative. The option to shoot RAW is available on most advanced and professional digital cameras.

There is much more latitude controlling exposure than with JPEG files. With a RAW image, no processing is done in the camera. The photographer has total control adjusting elements, such as sharpening or white balance,when editing an image.


all links courtesy of DIGICAM HELP. A nice site to check out.

grim
- Collapse -
Meta data?
Sep 1, 2006 1:47PM PDT

Grim, Why the heck have you been holding back this info from me?
I know, you just want to keep me guessing what all this is? :

- Collapse -
Have you tried google.com? Toss this word in too.
Aug 30, 2006 6:16AM PDT

When you hit a word you don't understand, toss it at google.com

Add WIKIPEDIA to find it's writeup.

Save the tougher items for here.

Bob