136

I'm try to move my current paperwork routine towards a paperless workflow (for the “administrative” type of papers, of course… not for serious reading tasks). There is one major annoyance thwarting me: people sometimes require me to print, sign and scan documents. They will not allow me to insert my scanned signature in an electronic file (even converted to PDF). It's for unimportant papers (e.g., not for contracts!), it's a waste of time, but I cannot make them budge.

Thus, I want to design a filter that takes PDF files as input, and gives them a “scanned document” look. What I have thought of so far:

  1. Rasterization at not-so-great resolution. I have a ghostscript-based filter that does it, and I've used it a few times already. But, the documents keeps their “pristine” aspect: white background is still white, etc.

  2. So, I considered getting a “scanned paper” texture from scanning a blank page, and apply it to my document. But: if I put it in front of the content with low opacity, the text might become too blurry; and if I put it behind the content, it works only if content has a fully transparent background (which is not always true for my documents).

  3. Now, I'm thinking TeX/LaTeX would be great tools to do that, but I cannot translate this nice idea into specifics…

So, what would you suggest?

8
  • 1
  • 3
    Is your scanner so crappy that people can tell the difference? I'm not sure I could tell the difference with our scanner. Or do people compare your signature and see that it's always the same? If the second case, sign your name a bunch of times, scan each of them and insert them randomly into your fake scans.
    – Alan Munn
    Jan 19, 2013 at 20:13
  • 3
    @AlanMunn with a common flatbed scanner and default settings, it's pretty easy to tell the difference between a rasterized page and a scanned page (I did a blind test with some friends): paper texture, scanner color artifacts (variations in color from what is originally pure black), compression artifacts, …
    – F'x
    Jan 19, 2013 at 20:51
  • 3
    @F'x, another option is just adding a (deceitful) watermark like "SCANNED 19JAN13 AT 20:13:31". Y'know, since we're lying. Prolly good enough for your bureaucrats.
    – commonhare
    Jan 20, 2013 at 0:03
  • 1
    This solution uses an entirely different program, so I'm not making it an actual answer. Distressing Documents: cthulhureborn.wordpress.com/2012/10/12/distressing-documents
    – BESW
    Jan 20, 2013 at 2:44

4 Answers 4

156

I guess this is a typical "use the right tool for the right task" question and for these kind of transformation, I would look for an ImageMagick solution:

The following is shamelessly taken from the ImageMagick example gallery, where it is described as a filter to simulate a photo copier effect:

convert letter.pdf -colorspace gray \( +clone -blur 0x1 \) +swap -compose divide -composite -linear-stretch 5%x0% as-scanned.pdf

Thereby

enter image description here

becomes

enter image description here

which to me looks pretty scannerish :-)

Fine-Tuning the Result

Lucas suggested to add also a bit of rotation (in the following I added -rotate 1.5 to the convert line), which improves the result even further:

convert letter.pdf -colorspace gray \( +clone -blur 0x1 \) +swap -compose divide -composite -linear-stretch 5%x0% -rotate 1.5 as-scanned.pdf

enter image description here

For a color scan, just leave off the -colorspace gray operator:

convert letter.pdf \( +clone -blur 0x1 \) +swap -compose divide -composite -gamma 0.1 -linear-stretch 5%x0% -rotate 1.5 as-scanned.pdf

color scan

14
  • 22
    I would rotate it by one or two degrees as well -rotate 2
    – Lucas
    Jan 20, 2013 at 5:40
  • 56
    This is both wonderful and sad at the same time.
    – Alan Munn
    Jan 22, 2013 at 2:28
  • 2
    This is brilliant!
    – nnunes
    Jan 22, 2013 at 16:45
  • 10
    You can add a coffee stain tex.stackexchange.com/questions/67656/…
    – alfC
    May 6, 2013 at 21:55
  • 3
    Our solution: convert $f -colorspace gray \( +clone +noise Random -threshold 99% -negate -blur 0x5 -level 97.5%,97.5% \) -evaluate-sequence min -blur 0xecho $RANDOM %2 +1 | bc` -level 25%,75% -rotate -0.echo $RANDOM %10 +1 | bc -sharpen 0x3.0 -blur 0xecho $RANDOM %2 +1 | bc -level 10%,90% -rotate -0.` echo $RANDOM %10 +1 | bc` -sharpen 0x1.2 -colorspace gray `
    – neutrinus
    Feb 23, 2015 at 10:38
16

Derived from @Daniel, this is a version that works on multipage pdfs:

convert -density 150 input.pdf -colorspace gray -linear-stretch 3.5%x10% -blur 0x0.5 -attenuate 0.25 +noise Gaussian output.pdf

This command will:

  • decrease the definition of the output pdf to 150 instead of 72 as the default (-density option, you can increase it and increase the -linear-stretch to obtain a similar result, but with some documents it doesn't work well)
  • blur a little less
  • add gaussian noise to simulate printed paper
  • process page per page the input pdf (@Daniel answer doesn;t work with multiple pdfs)
3
  • 1
    Please explain the difference between yours and the already existing answers. Aug 2, 2019 at 12:14
  • 3
    I cannot comment the original @Daniel answer. The main difference is that this one works with multipage pdfs and outputs a higher definition document.
    – fortea
    Aug 2, 2019 at 15:14
  • This works better Jan 7, 2020 at 14:40
6

Reviving this thread to share an action I made in Photoshop--it offers options to create a high-contrast BW scan or grayscale scan of slightly higher quality. I haven't made one for color scans, yet.

http://c.thomas.do/m2pO


To load action (Instructions written for Photoshop CS5 for Windows):

Open Photoshop and make sure Actions are visible in your workspace (from Window menu) On the Actions window in your side panel, click on the little menu icon on the top-right Select 'Load Actions' from the list Navigate to the .atn file on your computer and click Load.

Next, open a PDF or image file of a document into Photoshop (Right-click, Open With...) Select the action you want to try and then click on the Play icon

Adjust as needed, then save your file as a PDF (or you could Print to PDF). If you save it as a Photoshop PDF, use a very low quality setting. You can adjust the compression to yield more artifacts when setting the JPG quality to low.


I've compared this side by side with actual scans and it's pretty dead on.

Hope this helps.

4
  • ***Of course, you would need to use Photoshop to use this, I failed to mention!
    – user71146
    Jan 25, 2015 at 9:41
  • This is brilliant and deserves way more upvotes. Much better result than Imagemagick, in my opinion!
    – Doggie52
    Apr 5, 2015 at 10:14
  • The actions fail when in non-english versions of Photoshop due to the naming of the layers. "Layer 2" in spanish is "Capa 2" for instance. Dec 7, 2017 at 12:35
  • The link is broken
    – dca
    Jul 5, 2022 at 18:43
3

I'd like to add an answer that is maybe easier to implement for beginners and uses software that most people have on their computers anyways (also, the accepted answer seems to only convert one page at a time). This requires Windows 10 and Adobe Acrobat Reader/Pro DC:

  1. If necessary, activate Microsoft Print to PDF as described e. g. here.
  2. Open the original PDF file in Adobe Acrobat.
  3. Select Microsoft Print to PDF as the printer. selection of printer
  4. Open the advanced settings, choose "Print As Image" and select the resolution you want. I've found 150 dpi to be blurry enough. selection of resolution
  5. Click OK and print your file.
  6. You've now got a blurry version of your original file. If you want to, you can now rotate your pdf by a small angle (I'd say 0.7 degrees at most) using the pdfpages package, see this answer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .