0

I am using the simple image resize methode

list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;


$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);


imagejpeg($image_p, null, 100);

Eventhoug i had given the quality to maximum , when it comes to smaller image size , the generated image is of very poor quality (original 500px to new 100px ).

Is there any other way to increase the image quality ?

0

2 Answers 2

3

Yes there is a way to increase the quality: use ImageMagick instead of the GD library, if possible. The quality of the GD library is pretty poor.

Sign up to request clarification or add additional context in comments.

Comments

0

try this

<?php

header('Content-type: image/jpeg');

$image = new Imagick('image.jpg');

// If 0 is provided as a width or height parameter,
// aspect ratio is maintained
$image->thumbnailImage(100, 0);

echo $image;

?>

source http://php.net/manual/en/imagick.examples-1.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.