pixel and vectors

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
robuntu
Posts: 41
Joined: 2012-01-22T10:56:10-07:00
Authentication code: 8675308

pixel and vectors

Post by robuntu »

Hi imagick users,
I use imageMagick to create large ( I mean really large) images to print out as wallpapers and other 20squaremeters+ posters.
Therefore I always have to resize images by factor 10 or more, which works great on my 64GB Ram 16Core Xeon machine.
But now I got a new customer providing me pdf files with mixed images, text and vector graphics.

And here is my problem:
If I use -density to increase the pixels to get a good result with vectors the pixel images get large artifacts.
here the bi-cubical resize is much better.
But if I set a lower density and then resize the image, the vectors get blurred.

Is there a chance to force the density option to use bi-cubical algorithm to resize the pixel-images?
(This would be the best choice..)

Or is there a way to split the image into layers, resize the pixel image and scale the vector with density
and than recombine both?

Or is there another way?
I could try to use other programs like inkscape, but I need a command line version as I want to do some automation on that.

Thanks for your help,
Roland
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: pixel and vectors

Post by snibgo »

Inkscape can be used in batch mode.

IM passes the "-density" option to Ghostscript, for the rasterization. I don't know if GS has bicubic etc methods.

However, as you say, you might use two methods to rasterise the PDF pages, handling the vector and raster components separately, then combining them:

1. Extract the embedded raster images from the pages with pdfimages.

2. Use IM to rasterize the PDF pages (which will use Ghostscript), at whatever density you need for the vector portions. The portions from the embedded raster images will look bad.

3. Resize the outputs of (1), using whatever IM resize method works best.

4. In the outputs of (2), substitute the outputs of (3).

Step (4) could be done manually in Gimp. But it could probably be automated: search for the resized image within the rasterized page. This gives the required "-geometry +X+Y" for the composite, or "-repage +X+Y" for layer merge.
snibgo's IM pages: im.snibgo.com
robuntu
Posts: 41
Joined: 2012-01-22T10:56:10-07:00
Authentication code: 8675308

Re: pixel and vectors

Post by robuntu »

Hi snibgo,
thanks for your answer.
I know pdfimages to extract the raster images from a pdf, but is there a way to remove it from the pdf file?
This would make it a lot easier to handle the different parts separately.
Thanks
Roland
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: pixel and vectors

Post by snibgo »

I don't know a way to remove raster images from PDFs. I don't edit PDFs, so there may be a method/product I don't know about. A PDF editor could do that, but from batch? I don't know.
snibgo's IM pages: im.snibgo.com
Post Reply