/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] imagejpeg quality 100, increases filesize beyond original filesize?

Hello,

I’m now using imagejpeg to output images at 100% quality level. However, this increases the filesize beyond the original filesize of the original image by a lot.

For example, I have image.jpg:
1. image.jpg optimized for web in Photoshop at JPEG High 70% -> creates a file at around 125kb
2. Runs through the following script:

[code=php]
$imagepath = http://site.com/path/to/image.jpg;
$image = imagecreatefromjpeg($imagepath);
header(‘Content-Type: image/jpeg’);
imagejpeg($image, NULL, 100);
[/code]

3. Outputs image.jpg at a filesize of 600kb

After reading through some tutorials online, I understand that it’s not supposed to be possible to increase quality beyond its original source…so how is this possible?

Any help would be greatly appreciated. Thanks!!

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@QwertmanMay 22.2010 — I'm pretty sure that 100% doesn't mean you're setting it at 100% of whatever the current quality is, but rather 100% possible quality. Therefore if you're saving a file with quality 70% it's size will go up since it's increasing it by 30%. It's easier to think of it as just a score where 100 is the best quality- forget the % sign.
Copy linkTweet thisAlerts:
@Jarrod1937May 22.2010 — Keep in mind too that filesize does not mean quality. You can bloat the filesize and have the same or worse quality.
Copy linkTweet thisAlerts:
@boxofmochiauthorMay 22.2010 — Is there a way to shrink the filesize but keep the quality level at 100?

Or at least shrink the filesize back to its original, and keep the quality level at 100?
×

Success!

Help @boxofmochi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...