blurring text

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
ccurvey

blurring text

Post by ccurvey »

I'm so close, but I can't get it just right.

I have a 1-page PDF containing text. I want to convert this into a PDF with all but one line blurred. (This is kind of cheapo redaction -- I want the user to see that they're looking at an invoice sent to my firm, but not see other customers' information.)

I've gotten this far:

Code: Select all

convert.exe "c:\temp\foo.pdf" -region (792x71+0+0 -blur 0x2) -region (792x715+0+76 -blur 0x2) "c:\temp\bar.pdf"
and it looks great, but the unblurred section is still, well, blurry. I'm not sure if the blurring effect is bleeding out into the unblurred section, or if it's just the rasterizing of the text. I've been trying to play with density+resize without any visible success.

Can someone help me get this incantation right?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: blurring text

Post by snibgo »

Your command doesn't follow IM syntax. (Sadly, IM is poor at reporting bad syntax.) Try:

Code: Select all

convert.exe "c:\temp\foo.pdf" -region 792x71+0+0 -blur 0x2 -region 792x715+0+76 -blur 0x2 "c:\temp\bar.pdf"
To test just the general rasterizing effect, try:

Code: Select all

convert.exe "c:\temp\foo.pdf" "c:\temp\bar2.pdf"
snibgo's IM pages: im.snibgo.com
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: blurring text

Post by el_supremo »

When IM rasterizes the PDF it uses a default density of 72dpi which will make the text look rather poor. Add a -denisty command before reading the PDF to change the default e.g.:

Code: Select all

convert.exe -density 300 "c:\temp\foo.pdf" -region 792x71+0+0 -blur 0x2 -region 792x715+0+76 -blur 0x2 "c:\temp\bar.pdf"
Of course, this will probably change the coordinates of the regions which need blurring but once you figure out the new region, the unblurred text should look better.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Post Reply