PHP 8.5.0 Alpha 2 available for testing

Voting

: three minus zero?
(Example: nine)

The Note You're Voting On

andy at live dot nl
16 years ago
I had a problem when using $im->setImageFormat('jpeg');
Image colors got inverted when i converted pdfs to jpg thumbs.
Had to add $im->setImageColorspace(255); to solve it.

<?php
// read page 1
$im = new imagick( 'test.pdf[ 0]' );

// convert to jpg
$im->setImageColorspace(255);
$im->setCompression(Imagick::COMPRESSION_JPEG);
$im->setCompressionQuality(60);
$im->setImageFormat('jpeg');

//resize
$im->resizeImage(290, 375, imagick::FILTER_LANCZOS, 1);

//write image on server
$im->writeImage('thumb.jpg');
$im->clear();
$im->destroy();
?>

<< Back to user notes page

To Top