简体   繁体   中英

imagemagick pdf to jpg - font quality bad

I do upload PDFs to PHP and extract the pages as JPG in different resolutions in a kind of batch through JS + AJAX-Calls to work arround PHP timeout.

But the font is rendering not so pretty... what can I do?

$pdf = new Imagick();
$pdf->setresolution(225, 225);
$pdf->readimage('mypdf[0-5]');
$written = $pdf->writeimages('previewfolder/pages/hq-0.jpg', FALSE);
$pdf->clear();
$pdf->destroy();

I tryed upsetting the values of setresolution to 500 and 500 , then the font is a Little bit better but the Image is also much bigger in Resolution. Here an screenshot: http://imgur.com/5U88bx5

My Target: small Image (1000px*1000px) but with as max font-quality as possible.

Hopefully someone has an Idea.

Regards, lippoliv

as often: mistake 40 (the mistakes sits 40cm in front of his Monitor)...

$pdf = new Imagick();
$pdf->setresolution(350, 350);
$pdf->readimage('mypdf[0-5]');

// Because we have multiple pages, we have to process each page.
foreach ($pdf as $page) {
    $page->resizeimage(1500, 1500, \Imagick::FILTER_UNDEFINED, 1.1, TRUE);
}

$written = $pdf->writeimages('previewfolder/pages/hq-0.jpg', FALSE);
$pdf->clear();
$pdf->destroy();

Thanks to Mark Setchell who brought in that Idea and made me thinking about why the resize doesn't work. And than ofter another hour of Google I found an example about resizeing Images, pointing out that you have to resize each Frame.

So I thought may I have to resize each single page of my PDF (in that example there are 6 pages) and now it works: http://imgur.com/UoP3kMK

Now I can up- / downscale the Image size as I like to and get nice Fonts :) Even as a JPG.

Thank you all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM