|Pathologically Eclectic Rubbish Lister|
GD loss of qualityby the_slycer (Chaplain)
|on Apr 19, 2005 at 17:54 UTC||Need Help??|
the_slycer has asked for the wisdom of the Perl Monks concerning the following question:
I'm going to add a bit of explanation about why I'm in this bind before getting into the problem.
I'm working at a place where perl is being phased out - but oh so slowly. The reasons for it are many, and I won't go into it here. However, because it's being phased out, there's been no real drive to upgrade perl, and it's difficult at best to get support for newish things.
Having said that, I'm using perl 5.005_02 on redhat 6-2, and I cannot upgrade it. It's also going to be a next to impossible task to do what I really want to do, and install Image::Magick.
I'm stuck using GD (it's already installed) to resize an image, so quick test code looks like this:
Which seems to be working fine-ish, it's creating 800x600 images for sure, but there is a drastic loss of image quality. And I don't mean the standard blockiness etc, I mean like a complete loss of color, so all I see are vague outlines of an image. This obviously is not acceptable, so, I'm trying desperately to discover why it's doing this.
The question is, has anybody run into this problem before? Why such a massive loss of quality? Secondly, are there any other potential modules that I can use other than Image::Magick (which rely's on drivers/software not currently installed on the redhat 6.2 boxes) and/or GD to perform this task? Or am I stuck going to bat to try and get ImageMagick installed?
On a semi related note, the *real* reason that I'm attempting to do this is so that all the image manipulation etc can happen "in memory". We've been running into a problem with a script that does this all by creating files on the machine, running a command on them, and then uploading the new file elsewhere. There are a lot of 0 byte files being created, and I suspect either NFS, or our clustering, or disk space as being the root cause. Has anybody run into the 0 byte problem before when accepting file uploads using an old version of CGI?
Note that the open & print to TMP is not actually necessary, nor will it be like this in the production code, this is just for me to view the images so I can run some tests. In actuality the file will be inserted into a BLOB in the database, hence the idea that we do this all without creating temp files...