By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,053 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,053 IT Pros & Developers. It's quick & easy.

Do imagejpeg(), imagegif(), etc. compress images?

P: n/a
I am using the imagejpeg() and the imagegif() (also imagepng(), etc.)
commands that will write an image Object back into an existing image
in a directory.

Everything works fine, except that when I compare image filesizes
between the original and the one created via imagejpeg(), the size of
the latter is 50% of that of the former.

example: myimage.jpg = 29K
imagejpeg($newImage, 'myimage2.jpg');
myimage2.jpg = 15K

However, everything about myimage.jpg and myimage2.jpg are completely
identical in every other way: same height, same width, same MIME type,
they look EXACTLY alike in the browser!

is there some compression going on that I am not aware of with
imagejpeg()?

Thanx
Phil
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Straight out of the manual (http://www.php.net/imagejpeg), the optional 3rd
praramter controls quality (compression).

Phil Powell wrote:
I am using the imagejpeg() and the imagegif() (also imagepng(), etc.)
commands that will write an image Object back into an existing image
in a directory.

Everything works fine, except that when I compare image filesizes
between the original and the one created via imagejpeg(), the size of
the latter is 50% of that of the former.

example: myimage.jpg = 29K
imagejpeg($newImage, 'myimage2.jpg');
myimage2.jpg = 15K

However, everything about myimage.jpg and myimage2.jpg are completely
identical in every other way: same height, same width, same MIME type,
they look EXACTLY alike in the browser!

is there some compression going on that I am not aware of with
imagejpeg()?

Thanx
Phil

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.