This is a discussion on Can a resized image be of Photoshop quality? within the PHP Language forums, part of the PHP Programming Forums category; I have resized an image from 1024 x 768 to 800 x 600 with the following code: <?php $tmp_dir = $...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have resized an image from 1024 x 768 to 800 x 600 with the following
code: <?php $tmp_dir = $_FILES["image"]["tmp_name"]; move_uploaded_file($_FILES["image"]["tmp_name"], "c:/test/1.jpg"); $image = imageCreateFromJPEG("c:/test/1.jpg"); $new_image = imagecreatetruecolor(800, 600); imagecopyresized($new_image, $image, 0, 0, 0, 0, 800, 600, 1024, 768); imagejpeg($new_image,"c:/test/new/fuckyou.jpg"); ?> This does not create an image of a decent quality. Is it possible to resize an image and have it look like a photoshop resized image? |
|
|||
|
Hi,
Keiron Waites wrote: > I have resized an image from 1024 x 768 to 800 x 600 with the following > code: > > <?php > $tmp_dir = $_FILES["image"]["tmp_name"]; > move_uploaded_file($_FILES["image"]["tmp_name"], "c:/test/1.jpg"); > $image = imageCreateFromJPEG("c:/test/1.jpg"); > $new_image = imagecreatetruecolor(800, 600); > imagecopyresized($new_image, $image, 0, 0, 0, 0, 800, 600, 1024, 768); > imagejpeg($new_image,"c:/test/new/fuckyou.jpg"); > ?> > > This does not create an image of a decent quality. Is it possible to resize > an image and have it look like a photoshop resized image? Use imagecopyresampled(), or for even better results see some of the contributed routines in the PHP manual (see the entry for imagecopyresampled() and look through the user comments). Regards, Luke |
|
|||
|
int imagejpeg ( resource image [, string filename [, int quality]])
There is a third arg for imagejpeg() function, which is quality. Right now you are using default value for it. try using a higher value like 90 or so. It worked for me. Hope this helps. sanjay "Keiron Waites" <webmaster@-NOSPAM-sharemonkey.com> wrote in message news:bmgqp9$rrq$1@hercules.btinternet.com... | I have resized an image from 1024 x 768 to 800 x 600 with the following | code: | | <?php | $tmp_dir = $_FILES["image"]["tmp_name"]; | move_uploaded_file($_FILES["image"]["tmp_name"], "c:/test/1.jpg"); | $image = imageCreateFromJPEG("c:/test/1.jpg"); | $new_image = imagecreatetruecolor(800, 600); | imagecopyresized($new_image, $image, 0, 0, 0, 0, 800, 600, 1024, 768); | imagejpeg($new_image,"c:/test/new/fuckyou.jpg"); | ?> | | This does not create an image of a decent quality. Is it possible to resize | an image and have it look like a photoshop resized image? | | |