Page 1 of 3
JPEG Image Quality - how good is it?
Posted: 2010-11-20T19:02:18-07:00
by Fubster
We have been using GD2 on our server, exclusively for creating thumbnail images. I'm doing some additional processing on the full-sized images, and I am appalled at the JPEG write results using GD2. It really breaks down around reds, which I guess our human eyes are more sensitive to...here is an example:
I created this image with Photoshop, saved with JPEG quality = 11 (photoshop's quality is from 1-12):
I used this code:
Code: Select all
<?php
$downimage = imagecreatefromjpeg ("Photoshop.jpg");
imagejpeg ( $downimage, "php_gd2.jpg", 100);
?>
And the resulting JPEG looks like THIS:
Now, my question is this: Will ImageMagick give me a better resulting image than this? Would someone be willing to take that first image and run it through ImageMagick just so I can see the results?
I've already asked my host to install ImageMagick on our server, but sometimes he requires several reminders. I'm wondering how hard I should push to get this done quickly.
Thanks for any and all assistance!
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-20T20:02:17-07:00
by fmw42
I used the IM command line to do this, but you can get the same results from PHP using the exec command to process the IM command.
Here is my command and result. But note that even using -quality 100, the image will be decompressed and recompressed and therefore lose some quality.
convert Photoshop.jpg -quality 100 Photoshop_IM.jpg
IM 6.6.5.8 Q16 MacOSX Tiger (latest IM release)
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-20T20:50:45-07:00
by Fubster
Wow, but that is SO MUCH BETTER than what I am getting via GD2! Thank you so much for the legwork. Now if I can just get IM installed on my server. Time to go rattle a cage.
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-21T02:05:47-07:00
by Bonzo
Couple of points - do not just ask for Imagemagick as they will probably install some old version like 6.05 which comes standard with some of the Linux installations. Try and get a later version installed; if they use cpanel it will probably be something like 6.2.8 You will also need safe mode turned off.
There is a php API called Imagick which is not very well supported and I think the best way to work is with php and the command line.
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-21T14:01:13-07:00
by fmw42
Try very hard to get as recent version of IM as you can (or see if they will install the current one in your account). Even 6.2.8 is over 350 versions old. Lots of changes and improvements from 6.2.8
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-21T14:25:49-07:00
by Fubster
Thanks for the help guys...I was actually looking at the downloads last night, and could not figure out what I needed. I THOUGHT I would be getting the interface to use the commands listed here:
http://php.net/manual/en/book.imagick.php. But now it sounds as if you are suggesting that I call ImageMagick via command line (which I've never done, but I'm sure I can figure out easily enough).
Doesn't the php interface to ImageMagick just provide the interface to whatever version is installed?
What exactly should I be asking my host to install? (links would be most helpful).
Thanks for the continued help!
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-21T14:44:54-07:00
by Bonzo
Imagick is that its not very well documented/supported and you only get the options that have been built for it.
Using command line with php you get all the options and I think its a lot easier to use. You can see some examples on my site; I also have a couple of Imagick examples.
You want Imagemagick installed along with Ghostscript for any text functions ( that is probably already installed ). I am not sure what the latest WHM/cpanel version is but my VPS managers installed 6.4.8 without argument.
I installed 6.6.0 on an unmanaged server but I think most hosts like to use an older version to be safe.
It depends what you want to do but the later the version the more options there are.
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-21T16:16:38-07:00
by fmw42
Bonzo is not suggesting that you run IM from the command line per se. What he is saying that PHP has the exec function that can run the same command as it was on the command line, but from within PHP. It is much more flexible that way and you can even run shell scripts. See my link below. Also PHP IMagick is not generally any faster than PHP exec and you have to make multiple calls to each IM function. Whereas using exec, you can run the whole IM command (multiple functions chained) with one exec call if you want.
If you decide you want Imagick, you have to install that as well as ImageMagick.
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-21T18:44:18-07:00
by Fubster
I understood, even if my reply was not clear that I did. And I really appreciate your comparison on speed...I hadn't thought about it, but I'm sure at some point I would have.
So, I have this link
ftp://ftp.fifi.org/pub/ImageMagick/ for downloads. Correct? Can I assume that ImageMagick-6.6.1-10.zip is the same as ImageMagick-6.6.1-10.tar.gz and the others with same version number, that the just use different archive methods? Which version is the latest "stable" version? It looks like 6.6.5-9 is the highest on that site.
And GhostScript...is that a php compile option? or something else? How do I find out if it's installed? phpinfo? Only answer if you know off the top of your head, I am also capable to doing a google search and will find the answer quickly enough
As always, thanks for your help, you guys have been outstanding
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-21T21:21:56-07:00
by fmw42
I usually go to
http://www.imagemagick.org/download/www ... .html#unix then
ftp://ftp.imagemagick.org/pub/ImageMagick. I use the .tar.bz2 version as it is one of the smaller downloads, but I believe they are all the same once decompressed.
Note that I had trouble installing the latest 6.6.5-9 and reported it. See Bugs. So take the previous one if you can or wait for the next one.
Installing from source, requires that you first download and install delegate libraries to support a bunch of image formats, such as jpeg, png, tiff and ghostscript for dealing with PDF. see
http://www.imagemagick.org/download/delegates/
Once you have your delegates installed properly, then install IM. see
http://www.imagemagick.org/download/www ... .html#unix
These are all unix/mac install. If you are windows, you need
http://www.imagemagick.org/download/www ... ml#windows
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-22T11:33:59-07:00
by Bonzo
Now if I can just get IM installed on my server. Time to go rattle a cage.
Why are you looking at downloads if you are not installing it or has something changed and we are on a different question ?
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-22T11:37:40-07:00
by Fubster
If I can point my host in the right direction, I have a better chance of success. At this point, I may actually try to do it myself anyway, I'm just not sure if the login I use has security.
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-22T11:41:07-07:00
by Bonzo
What sort of hosting do you have as shared will probably be a problem although I understand you can install Im into a folder but I have never tried it. The hosts will need to do it.
Managed they should do it for you or if you have WHM you can do it from there.
Unmanaged without WHM you can do it from SSH.
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-22T11:44:47-07:00
by Fubster
We are hosted but non-shared. I have access to WHM and SSH. WHM would be the preferred method? The more help (instructions) I can get the better, I have never installed something onto this server before.
As for my login, I login as "root" - which I thought gave me access to everything. Then about three weeks ago I tried to set the clock, because it is running about 10 minutes fast, and I got a security error.
Re: JPEG Image Quality - how good is it?
Posted: 2010-11-22T11:45:53-07:00
by Fubster
Fubster wrote:We are hosted but non-shared.
That should have been "managed but non-shared".