Pdf to image using php-imagick api
i want to convert the PDF to image.But when the out put image generate it's get blur from original.Here is code
$uploadfile = ".pdf[53]";
$img = new Imagick($uploadfile);
$img->setResolution(300,300);
$img->resampleImage(150,150,imagick::FILTER_UN开发者_如何学JAVADEFINED,1);
$img->resizeImage(512,700,Imagick::FILTER_LANCZOS,0);
$img->setImageFormat('jpeg');
$img->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH);
$img->writeImage ( "p-53.jpeg" );
Can you please help me. Thank you.
Remove the resample and the resize calls and see what you get. It looks like you are shrinking it and then upsizing it.
edit: setResolution(300,300) is too late -- the image has already been rendered. Do it like this:
$im = new Imagick();
$im->setResolution( 300, 300 );
$im->readImage( $uploadfile );
精彩评论