set density parameter for imagick with php

后端 未结 2 649
说谎
说谎 2021-01-05 09:41

I want to convert a pdf page to a png image with Imagick.

I tried with PHP, but the image quality was very low.
When I tried with command line, the result was pe

相关标签:
2条回答
  • 2021-01-05 10:11

    You need to set Resolution before you read the file.

    $im = new imagick();
    $im->setResolution(200,200);
    $im->readImage(__DIR__ . DIRECTORY_SEPARATOR.$PDFName.'['.$i.']');
    

    Than, the result will be perfect.

    Hope this help someone.

    0 讨论(0)
  • 2021-01-05 10:38

    From the manual http://php.net/manual/en/imagick.setresolution.php

    Imagick::setResolution() must be called before loading or creating an image.

    See this answer Pdf to image using php-imagick api

    0 讨论(0)
提交回复
热议问题