Create Transparent Signature Image File
Posted by binglongx on July 31, 2010
1. The signature image from a scanner or digital camera often does not have uniform white background due to high color resolution of the scanner. See this example, you can find some shades in the background. Since some software may not be able to handle transparency correctly when you apply the signature to the document, it is always the best to prune the image file to have the least background (the sample image below is however not a very good example in terms of least background).
2. Enhance the image to remove the unneeded shades in background. You can use any reasonable image software to do so, for example GIMP. I just use the free IrfanView to do the trick. Choose Image|Enhance colors, then for my image I set the contrast to 65:
3. The resulted image has a much cleaner backgournd:
4. To create a transparent image, we need to have more powerful image software than IrfanView. GIMP is a free and open-source replacement for Adobe Photoshop. Open the image in GIMP (mine is Version 2.2.10).
5. Right click the image and add an alpha layer to it. You will not see visible change in the image.
6. Right click the image and select region of image by color:
7. Click any point in the white background area. All the pixels with similar color are then selected. If you look carefully in the image below, you can see the boundary of selected region near the signature ink. There may be a few other little spots in the background that do not fall in the selected region. That’s okay. However, if you see too many of these, you may need to go back and try Step 2 color enhancement.
6. Right click the image and erase the selected background region:
7. The resulted image is a transparent one with only the ink areas left. GIMP shows the transparent region with gray patterns.
8. Click File|Save As, and save it as GIF, the file format that can handle transparent color.
9. GIMP warns because GIF can only handle at maximum 256 indexed colors, while the original image is true color 24-bit image. For our case 256 color image is good enough for a signature image. Just let it convert it to indexed color image and click “Export”.
10. Click OK to confirm saving a GIF file.
Now you have the resulted sample.gif as a reusable transparent signature file, to be used in PDF or Word documents.
Reference: Creating Transparent GIFs with GIMP