1

How can I sign a document only using GIMP such that it looks like it was printed to actual paper, signed with a blue ballpoint pen, and then scanned again.

I was sent an important document and, for legal reasons, I was asked to sign it. I don't own a printer, and this document has sensitive data on it that could be used for identity theft. For privacy/security reasons, I don't want to take it to a print shop.

Since the COVID-19 pandemic, I've found that many organizations are more accepting of documents "signed" only using picture editing software. However, I think it's a grey area for a lot of businesses and governments recently, so I want the signature to look as authentic as possible.

Of course, I'm very aware that non-cryptographic signatures don't provide a trustworthy means of authentication. But, unfortunately, the country where I live doesn't utilize asymmetric cryptography for signing of documents, so if I want to get anything done I have to actually sign things they give me by hand.

Anyway, using the pen tool in GIMP, I've created a signature on a transparent background. It looks decent, but not great.

png image of blue-ink signature

example of A4 document sent to me example of the above document that's 'signed' using the above png signature created in GIMP

There's a few things I'd like to adjust:

  1. The pen stroke looks like it was made on a computer. How can I adjust it to look like it was made by a human hand using a ball-point pen? (eg jitter, smooth stroke, etc. The thickness of the line should probably vary)
  2. The color is monochrome, but an actual signature with a blue-ink ballpoint pen should vary in shades as the ink is dragged across the paper. How do I make the color look more authentic?
  3. The document itself doesn't look printed and scanned. What filter(s) can I use that make this pristine PDF look like it was actually printed, signed, and then scanned?

How can I "write" my signature on a PDF document using GIMP to make it look like I printed, signed with blue ink, and scanned the document -- without actually having to print it?

9
  • What OS are you using? macOS can scan a real signature written on paper using the built-in camera & convert it for use in documents.
    – Tetsujin
    Nov 8, 2022 at 19:33
  • Linux. And please only provide answers that use libre/open-source (I said GIMP in the original question, but I'd be open to inkscape too) Nov 8, 2022 at 19:34
  • "answers that use free-software" - software recommendations are off-topic, sorry. You could do this on any Mac using built-in tools, or on any computer with a Wacom or similar. For 'software' & just a mouse, you're going to need something that can fake a pen + pressure… not as simple as it sounds.
    – Tetsujin
    Nov 8, 2022 at 19:36
  • 1
    I'm not asking for software recommendations lol. I'm limiting the scope of the question/answers to GIMP for raster work and inkscape for vector work. Nov 8, 2022 at 19:38
  • As stated, you'd be better off taking a photo of the document and the signature, then compositing the photos in software. Trying to "degrade" things realistically using pure digital means is actually far more daunting and difficult.
    – Scott
    Nov 8, 2022 at 19:43

3 Answers 3

1

If you don't have a graphics tablet and pressure sensitive stylus, then just take a photograph of the signature. Write it in black ink on white paper. Use the flash on your camera/phone - or scan it if you have a scanner.

This is for GIMP

  1. Click and drag the photo file onto your open document in GIMP

  2. Scale it using the Scale tool - click and drag the corner handles to scale. Click and drag the centre handle to move it into position.

enter image description here

  1. Draw a rectangular selection around the signature, and do Layer > Crop to Selection

  2. Do Colors > Destaturate > Color to Gray

enter image description here

  1. Do Colors > Levels, and make an adjustment like this, moving the little triangles shown highlighted in red. The idea here is to get a pure white background and black text

enter image description here

  1. Do Colors > Colorize, and adjust the hue saturation and lightness to turn it blue.

enter image description here

  1. Set the layer blending mode to "Multiply". This will blend it with the document layer below.

enter image description hereclick to enlarge

14
  • Wow, that's really good. I think it would pass 8 times out of 10, but if you look close then [a] you can see that the blue in the pen's ink is monochome, [b] the white of the document is also monchrome (perfect white), [c] the document is perfectly angled, and [d] you can't see the corners of the document. In an image that was printed, signed, and scanned, the blue wouldn't be one perfect shade of blue, the white background would have some occasional darkening, the document would be tilted a few degrees left or right, and the corners of the document would probably be visible. Nov 8, 2022 at 23:30
  • This was just a crappy phone photo. A proper colour scan could be used, and you wouldn't need to convert it to monochrome. You can do this with a colour image. You may still have to do a levels adjustment if the background is not pure white. If you had a graphics tablet and stylus, you can set up GIMP so that pressure affects line thickness and opacity, like a real pen. Trying to degrade a document so that it looks like a scan would likely take a book to explain. You could overlay a crappy paper texture (same technique with multiply mode).
    – Billy Kerr
    Nov 8, 2022 at 23:36
  • Hmm, I'm surprised there's no magic python filter in GIMP that "degrades" a document so that it looks like a picture was taken of it Nov 8, 2022 at 23:38
  • @publishjunior There might be one somewhere, But most of GIMPs plugins need to be installed separately. You won't find this in the standard set of filters. Finding one may be a bit like finding a needle in a haystack.
    – Billy Kerr
    Nov 8, 2022 at 23:41
  • 1
    @publishjunior also realize the need for subterfuge of this type isn't a very common occurrence.
    – Scott
    Nov 8, 2022 at 23:48
0

This is not much more than you have already got from others, but I suggest you to use Krita. It's free and it has one substantial advantage over GIMP. Many adjustments such as blur and color curves can be non-destructive "masks". They make much easier to match items in different layers.

As already shown by others, layer blending mode "multiply" can fade full white. There's no need to remove for ex. the white background of the signature if you have adjusted it's background to white and let the signature layer have blending mode multiply.

See my Krita screenshot:

enter image description here

A piece of white paper was photographed on a table with my phone. It's ideal if you have the signature already written on it to the right place and the paper is a brand new sheet. My paper had some dirt and numerous slight bends. A little amount of dirt is not fatal, but it's difficult to warp the text layer to follow bends. It's anyway tried.

I photographed at first the plain paper, wrote the "signature" to an approximately right place and shot a new photo.

The signature layers are, of course, cropped to as small as possible and their edges are faded smoothly to avoid potential difficulties caused by not so exactly white backgrounds.

As said, ideally only one photo should be shot. I shot the signature separately only to see what it causes. The separate signature layer needed contrast boost so that the paper became full white to make multiply to work. It unfortunately faded from the paper the slight debossing caused by my quite heavy hand an the ballpoint pen. I tried to compensate by inserting a grey copy which was shifted a little to make an illusion of the debossing shadow.

The paper on the table is as my phone took it. I couldn't shoot perpendicularly, because I do not have proper tilted lights. Being above the paper generated an ugly shadow. The text layer got perspective warp for that reason. It got also another warp to even a little follow the bends of the paper. The barrel distortion caused by the lens of the phone camera is also tried to be inserted the text in the same warp session. Everything would be much easier if there was no need to distort the text.

The text got a slight blur. It cannot be sharper than the paper photo. The signature got all errors automatically because it was shot in right conditions with as poor equipment as the paper.

Only one adjustment mask was used. It's the color curves in the text layer to reduce the contrast.

The idea was to degrade everything as bad (but not worse) as my photo of the paper. Be sure that everything has matching pixel dimensions. Nothing must be scaled more than few percents. If one wants he can flatten the image to a single layer after everything seems to match and then increase the contrast or adjust the white balance.

You tried to insert an uniform single color signature. Forget it. A signature is generally far too complex due the changing pen speed and pressure. If you wonder how to clip a signature out of paper to be inserted elsewhere and not by using blending mode (or equivalent layer mask) to fade white, forget it, too. No easy method can perform such perfect clip.

Warnings:

  1. In western countries inserting a fake signature to create some fake evidence or to commit a fraud is a criminal action and it can be criminal even before one tries to use it.

  2. This is too elementary edit to stand any forensic investigation except if the case is "you committed a fraud".

0

I've been using this script to produce a "looks like it was printed and scanned" document, and it's working ok.

#!/bin/bash
set -euo pipefail
# thanks https://stackoverflow.com/a/53180170/1410035 for the imagemagick stuff
# thanks https://askubuntu.com/a/256449/234373 for the ghostscript stuff
# might have to comment one of the following lines in /etc/ImageMagick-7/policy.xml:
#  <policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,PDF,XPS}" />
#  <policy domain="delegate" rights="none" pattern="gs" />
# It seems you want basically everything in that file to be commented to kill the
# security.

: ${1:?first param must be input PDF}
: ${2:?second param must be output PDF}

noise="-attenuate 0.2 +noise Multiplicative"
if [ ${NOISE:-1} = 0 ]; then
  echo "[INFO] disabling noise"
  noise=""
fi
density=${DENSITY:-200}

convert \
  -density $density \
  "$1" \
  -rotate 0.5 \
  $noise \
  -colorspace Gray \
  - \
  | ps2pdf \
  - \
  "$2"

  # this also works instead of ps2pdf
  # | gs \
  # -sDEVICE=pdfwrite \
  # -dCompatibilityLevel=1.4 \
  # -dPDFSETTINGS=/screen \
  # -dNOPAUSE \
  # -dQUIET \
  # -dBATCH \
  # -sOutputFile="$2" \
  # -

# to get rid of the grey background for inputs on fillable PDFs, you can run the
# PDF through gimp.
#  1. open it
#  2. export as PDF
#  3. on the export dialogue, use layers and pages and reverse
#  4. then run it through this

At first I thought this would be simple but there's lots of gotchas:

  • final file size isn't too big
  • quality isn't lost
  • fillable PDF weirdness

This script is passable, but can still be improved. I bought a tablet and I'm still trying to solve the other part of the equation: "draw with ball point pen" effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.