Please forgive me if this has been asked answered or considered trivially basic but I'm very curious.
Why is a jpeg from my digital camera (7 gigapixels, 1.5 Mb) three times larger than an image resulting by copying it with GD.
For example, the following code:
$im = ImageCreateFromJPEG("file1.jpg");
$width = ImageSx($im);
$height = ImageSy($im);
ImageJPEG($new, "file2.jpg");
will open a 1.5 Mb jpeg file, gets its image data, and copies it into a new jpeg file only 449 kb in size.
I'm assuming, the jpeg display information of the first file only accounts for 1/3 the file's information and that the resulting jpeg still has every bit of display information as the first but that all the raw camera information was also stored in the first file but not copied to the second.
I'm I at all close?
I'm just curious but I'd like to knew if an image reproduced with GD is any "less" than the original. Also I'm am now very curious about what the heck is jpeg information anyway.
-cheers
woozy
Basic question: Why are camera jpegs larger than GD repros?
Moderators: onion2k, General Moderators
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: Basic question: Why are camera jpegs larger than GD repros?
jpeg is a lossy format - it's likely that the compression on your camera is set very low to keep image quality high, but the default settings for the PHP function are much more aggressive.
Re: Basic question: Why are camera jpegs larger than GD repros?
Also, the exif data in the jpeg most likely contains a thumbnail image with a pretty decent size. Other comments and info in the exif data could take up significant room. That combined with kierans explanation makes a lot of sense.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.