While filling forms and preparing documents on the computer, I come across needs to put my handwritten signature on the document. In such cases, the printing of the document, signing it by hand and then scanning it to produce the soft copy is too much. It is useful to have an image of the signature which can be easily inserted into documents.
On Linux, we can use the following steps to produce an image file where the handwritten signature stays in a transparent background.
(1) Put the signature on a white paper and take a photograph.
(2) Use a suitable tool to crop the photograph file to remove the unnecessary edges and have only the area covering the signature (e.g., Shotwell Viewer). Let's say the resulting image file is original.jpg.
(3) Run the following command to push the whiter pixels to fully white and darker pixels to fully black.
convert original.jpg -colorspace gray -threshold 28% filtered.png
(4) Run the following command to set the while pixels as transparent.
convert filtered.png -transparent white signature.png
On Linux, we can use the following steps to produce an image file where the handwritten signature stays in a transparent background.
(1) Put the signature on a white paper and take a photograph.
(2) Use a suitable tool to crop the photograph file to remove the unnecessary edges and have only the area covering the signature (e.g., Shotwell Viewer). Let's say the resulting image file is original.jpg.
(3) Run the following command to push the whiter pixels to fully white and darker pixels to fully black.
convert original.jpg -colorspace gray -threshold 28% filtered.png
(4) Run the following command to set the while pixels as transparent.
convert filtered.png -transparent white signature.png
Now, the resulting signature.png file contains the handwritten signature in black color while the background stays as transparent. This file can be used for the purpose of inserting the signature into electronic documents.