Drawing lines on a pdf without converting

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
Manofwax
Posts: 2
Joined: 2015-10-24T01:56:17-07:00
Authentication code: 1151

Drawing lines on a pdf without converting

Post by Manofwax »

Hello,
I've an high resolution pdf file containing a raster image, I need to add two lines on it. I'm using this command:

Code: Select all

convert in.pdf -draw "line 35,0 35,1000" -draw "line 216,0 216,1000" out.pdf
My issue is out.pdf comes out in super shitty quality, the image is all blurry and the file size is an half of the original (6MiB instead of 11.7MiB). I tried using -quality or -density but it seems they are ignored, for example using -quality 100 or -quality 1 doesn't change the output.

Is it possible to keep the original image exactly the same without converting it in any way?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Drawing lines on a pdf without converting

Post by snibgo »

If in.pdf contains a single raster image, the best extraction tool I know of is pdfimages, not ImageMagick. When it is extracted, use IM to draw lines and put it in a pdf.

If you really want to use IM to extract the image, use "-density X" before "in.pdf", where X is a suitable number for dpi, maybe 300.
snibgo's IM pages: im.snibgo.com
Manofwax
Posts: 2
Joined: 2015-10-24T01:56:17-07:00
Authentication code: 1151

Re: Drawing lines on a pdf without converting

Post by Manofwax »

Thanks, with -density before in.pdf it works perfectly!
Post Reply