Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5850275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T13:07:05+00:00 2026-05-22T13:07:05+00:00

I’m currently using php’s imagick to convert some PDF to images – This works

  • 0

I’m currently using php’s imagick to convert some PDF to images – This works well for the small detail that the images are ‘chopped’ during output.

This is due to the difference in information contained on the PDF vs the actual content dimensions.

The PDF reports to be a 612×792 72ppi document, yet when I export an image from it via preview on the mac, the image is 1651×1275 – How is this possible?

Obviously the export is correct as the image is viewed correctly in those dimensions – Could it be that the PDF was simply wrongly encoded where the width and height were mixed up? How can I detect this via code? Also the image export is of a different (much larger) size, roughly twice the size, this leads me to believe some information isn’t being read properly by imagick.

Basically I’d like to know if there is a proper way to determine the actual PDF content size, so that the images exported from it are at the best quality possible.

Thanks!

EDIT: (code added)

<?php
$im = new Imagick();
$im->readImage("SomeTest.pdf");
$im->setImageColorspace(255);
$im->setCompression(Imagick::COMPRESSION_JPEG);
$im->setCompressionQuality(60);
$im->setImageFormat('jpeg');
$im->writeImages("SampleImage.jpg");
?>

The pdf used is the following:
http://www.pantone.com/pages/MYP_mypantone/software_downloader.aspx?f=3

Also, here is the output of imagick from the identifyImage() function, which seems a bit wrong looking at the file size.

Array
(
    [imageName] => /tmp/magick-XXehkI8e
    [format] => PDF (Portable Document Format)
    [geometry] => Array
        (
            [width] => 612
            [height] => 792
        )

    [type] => TrueColor
    [colorSpace] => RGB
    [resolution] => Array
        (
            [x] => 72
            [y] => 72
        )

    [units] => Undefined
    [fileSize] => 50mb
    [compression] => Undefined
    [signature] => 9426f3fc4f45afd71941435a37d585d01e01d32458f3ca241e72892c2f7f35d5
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T13:07:05+00:00Added an answer on May 22, 2026 at 1:07 pm

    The image within the PDF was scaled down to some size within the PDF (or it would be cropped when you look at it in Reader et al).

    ImageMagick (which I ass-u-me imagick uses) uses GhostScript to convert PDFs to images. GhostScript is Quite Good at rendering PDF files. I have to wonder if you’re passing some bad info along.

    Can we see some code? Links to your input PDF and output image[s] would be nice too.


    I just ran gs 8.71 on your PDF, and it rendered fine. What version of GhostScript are you using?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a JSP page retrieving data and when single or double quotes are
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.