Detect vector or raster

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?".
Post Reply
Jonzo

Detect vector or raster

Post by Jonzo »

Hi, I'd like to treat my conversions differently depending on whether the image contains vector images or not. Is it possible to detect this? I've been googling and looking through documentation for aaages...

Thanks!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Detect vector or raster

Post by anthony »

That is just a selection based on image file format.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Jonzo

Re: Detect vector or raster

Post by Jonzo »

What about things like pdf or eps that can be vector or raster? Or am I wrong in my understanding of format?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Detect vector or raster

Post by anthony »

Both of those formats are vector. Though they can have raster components.

I have been wanting a method of extracting the raster components of these formats (without modification) but so far without success.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Jonzo

Re: Detect vector or raster

Post by Jonzo »

Thanks, I'll just assume that all pdf and eps files are vector then :-)

p.s.

My specific problem was related to extracting the pixel size of the images (through the identify command). It works fine when extracting the dimensions of a "raster" pdf, but when dealing with vector images it still returns a width and height... I don't know where it's getting it from (preview image?) but I'd be interested if you could shed some light on the situation :-)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Detect vector or raster

Post by anthony »

Not certain. It may be a function of how ghostscript is being called.

However please not that the actual number of pixels used in a vector'ed raster image is variable, depending on the current drawing 'density' or 'resolution'. that is it may not represent the actual number of pixels in the raster data that was used. (The pain, the pain!)

For example typically a single raster pixel, will use lots of pixels when the image is printed on a 600 pdi printer! The same goes for ghostscript 'rendered' documents, which is how converts such documents into a a raster image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply