identify on vector pdf

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
Marlies
Posts: 2
Joined: 2020-04-06T08:07:00-07:00
Authentication code: 1152

identify on vector pdf

Post by Marlies »

Hello,

I am using identify to get several pieces of information from an image, after which I resize the image and save it. I used identify mainly to determine mime/type so I could format a nice response to return to the user. (it's inside an image api)

I now want to resize vector images too, saving them rasterized with a specific resolution. To do that, I use identify so I can see if the image is a vector. (with the rule, pdf is always vector, which is, in our situation, true)

On my development computer I use: Version: ImageMagick 7.0.9-2 Q16 x86_64 2019-11-13 and everything worked perfectly well.

However, the api runs in a Docker container, which always uses the most recent IM version, dowloaded from here: http://www.imagemagick.org/download/Ima ... 9-5.tar.gz. In this case: ImageMagick 7.0.9-5 Q16 x86_64 2019-11-18

And it does not work inside the docker. If I use identify on the vector pdf that works fine on my machine, in this docker, I get an empty response. (pixel images work fine tough)
If I use it in the java api, an exception is trown saying "return code 1"

Does anyone know what can be going on? Is there no support for reading vector images anymore in imageMagick? Is there a way to solve this? Might a be missing a dependency for this?

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: identify on vector pdf

Post by snibgo »

IM delegates rasterization of PDFs to Ghostscript. If this fails, eg because a script inside docker can't access GS, then IM will write a message to stderr and then exit(1).

The "-verbose" setting will also helpful information write to stdout.
snibgo's IM pages: im.snibgo.com

Marlies
Posts: 2
Joined: 2020-04-06T08:07:00-07:00
Authentication code: 1152

Re: identify on vector pdf

Post by Marlies »

Hi snibgo,
Thanks for answering!
As it turned out, the docker image had no ghostscript installed! Adding it solved the problem.

Locked