473,385 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
1 2754
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Phil Powell | last post by:
re: http://us4.php.net/manual/en/function.imagegif.php I have one class method that resizes images, including GIF images, and works just fine doing so, even up to this line: eval('image' ....
1
by: André Gasser | last post by:
hello newsgroup, I just discovered a weird effect in my php code. here is the flow of my code: 1. upload jepg file to server 2. create new (empty) jpeg file using imagecreatefromjpeg()...
3
by: Bob Bedford | last post by:
I'm trying to add an imagejpeg result as an attachment of an email. For creating the email I'm using phpmailer class (http://phpmailer.sourceforge.net/) Now I do create an image from a jpeg file...
2
by: Jean-Marc Blaise | last post by:
Hi, I get a SQL2009C when using the 'compress' option for backup, but the util_heap_sz does not blow if I do not use the 'compress' option. What is the overhead induced by the compress option in...
5
by: Jigar Mehta | last post by:
Hye Friends!!, Happy New Year!! I am Jigar Mehta from India. Currently I am working on a project in which I need to compress some images on the harddisk... I want to make an engine that reads...
5
by: Oenone | last post by:
This may be a bit of a long shot... I've been working with the excellent new ReportView libraries in VS2005. Until this afternoon I've been extremely happy with everything I've seen them do....
21
by: cman | last post by:
does anyone know why i can't generate images with: header("Content-type:image/jpeg"); imagejpeg($img_number); i've tried different examples but i always get a text output as if the header...
5
by: zgh1970 | last post by:
Hi, Friends, default DB2 compression library. I am wondering if this option will have any new restriction on RESTORE in the following. (Can I used that backup imsage for restore at the...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.