Page 1 of 1

Import Images the Right Way (Size Does Matter!)

Posted: Wed Nov 01, 2006 10:10 am
by Erwin Denissen
This article explains how to successfully import bitmap based images (e.g. BMP, GIF, PNG) into FontCreator. If you are looking for tips about importing vector based images, then read this tutorial:
From Vector (e.g. an Adobe Illustrator image) to Font

Each month we receive numerous questions about how to improve the quality of imported glyphs. Some people ask how to reduce the number of points that make up a contour, while others want more detail. In both situations it is far better to prevent the problem than try to fix it. In this tutorial you'll find some general tips and tricks, related to the source image and the settings used during the conversion from image to outlines, that should lead to better import results.

Last week a customer (who gave me permission to use the image) send me this image and asked how to improve the quality of the generated contours. The letter "a" is hand-drawn at the size of 1 inch and is scanned at 150 dpi.


Image Dimension
Although the user manual tells you the recommended image dimension for importing images is between 100x100 and 500x500 pixels, this image (154x137) is just too small, because the character is actually a group of tiny strokes. So this detailed image should have been larger. Because this isn't always that obvious, it is best to experiment with smaller and larger images (for example scan at 150, 300, 600 and 1200 dpi). When you don't have the original hand-drawn letter, you can also resize your images with a paint utility (e.g. Microsoft Paint, Corel Paint Shop Pro or Adobe PhotoShop). This is not recommend as the results are usually slighty better when you use an originally scanned image.

Here is the same letter but scanned at 600 dpi (609x555):


Import Image dialog settings on the Image tab
Almost all default settings are fine:
Negative: Not checked
Threshold: 63
Erode - Dilate: No filter
Smooth Filter: Smooth
Import mode: Trace

Import Image dialog settings on the Glyph tab
Bounding: Contours
Position: Left Bottom (x = 0, y = 0)
Size Multiplier: depends on image size
I've used the size multiplier to compensate for the different scan resolutions.

The Results
The results are shown here (screenshots taken from Glyph edit windows with 18% zoom factor):


Personally I prefer the result from the 600 dpi scanned image. If you are satisfied with the result of the 300 dpi scan, do use that as it has fewer points. The 1200 dpi image generates way to much points, so that one is over the edge.

Resize the Glyph
It is almost always necessary to resize the glyph's outlines after importing an image. As explained in the user manual, there are several ways to accomplish this. When you know the desired height of a glyph, you could select all contours (in contour mode press CTRL-A) and then use the Size tab on the Transformation toolbar to resize to a fixed height. Just be sure you use the "Lock aspect ratio", as shown here:


Adjust Bearings
The left and right side bearings can be changed by dragging the vertical dashed lines to their desired position. The contours should be positioned between these lines, otherwise characters will overlap each other. You can also use the Bearings tab on the Transformation toolbar.

The bottom line is, do experiment with different scan resolutions before you decide to digitize your whole handwriting.

Do let me know if you would also like to see a more common hand-drawn letter and I'll show results of that as well.

More tips

Posted: Thu Aug 23, 2007 6:17 pm
by Erwin Denissen
Here are some more tips, that help you get better results when importing a scanned image.

First of all use a black marker or a felt-tipped pen to draw your characters. Draw them at least twice as large as you would normally write with a ball point pen. We suggest you use coated printing paper to ensure sharp, non-bleeding edges and lines. If possible experiment with matt, semi-matt, and gloss paper.

Put the original drawing as straight as possible on the scanner platen. Scan the paper as high-resolution (300 or 600 dpi) bitmap. Scan in grayscale (not black and white) and if possible save the bitmap in GIF or PNG format, as these will preserve the sharp edges of the letters while keeping the file size low. If these graphics formats are not supported, then BMP is the best alternative. Try to avoid the JPEG graphics format, and other formats that use lossy compression, as they are optimized for photographic images.

Note: when you scan a full page (A4) at 600 dpi, full color (24 bit), in BMP format, the size of the scanned image will be around 100 MB. When you scan in grayscale (8 bit), the size will be roughly a third. A 300 dpi scan is 1/4 of the 600 dpi size.

I intend to post a couple of relevant screenshots (importing a scanned image of a handwritten letter) within a couple of days.

Posted: Wed Sep 05, 2007 6:58 pm
by Erwin Denissen
It took a bit longer than expected, but here are the results of the promised experiments.

I've printed out the template from on both plain copier paper and (more expensive) coated paper. Then I wrote the Latin small letters a, b, and c on both pieces of paper. I used a black marker and drawn the letters about twice as large as I would have done when writing with a ball point pen. Besides the letters, I've also drawn a vertical line on both papers. The lines were deliberately drawn very slowly, to examine possible bleeding.

I've scanned the papers at 300 and 600 dpi and I've saved the images in bitmap and JPEG format.

Here are the relevant parts of the scanned images:

Coated paper, scanned at 600 dpi, grayscale (8 bit), saved in bitmap format - file size of the full page: 33,980 KB

Coated paper, scanned at 600 dpi, grayscale (8 bit), saved in JPEG format - file size of the full page: 2,425 KB

Besides the file size, I can't tell the difference between the above two images. I would have expected a significant loss of quality in the image saved in JPEG format *. Apparently the scanned image already comes with a lot of color leakage, so the quality decrease due to the JPEG compression is negligible. I'm not sure if the color leakage in the BMP image is due to the scanner, or due to the transmission of the scanned image from the scanner to the computer. I've used a Canon CanoScan LiDE 30/N1240U.

As the image above proofs, it is still wise to stay away from JPEG when you design your character outlines in other software, like Adobe Photoshop.

Plain copier paper, scanned at 600 dpi, grayscale (8 bit), saved in bitmap format - file size of the full page: 33,980 KB

Both plain copier paper and coated paper give reasonable results.

* The compression used when saving an image to the JPEG format, produces color leakage beyond the edges of objects.

Vertical line drawn with same (thick) marker, different paper


As you can see, the marker bleeds more on the plain paper. Keep this in mind when you are a slow writer.

Posted: Thu Sep 06, 2007 1:26 pm
by Erwin Denissen
I'm now going to import character a that I wrote on the coated paper, and scanned in at 600 dpi.
I've set the threshold value to 96, and set the smooth filter to Super. I've set the multiplier (Glyph tab) to 10.

The imported result is shown below:
The imported outline contains 37 points (inner contour 13 points, outer contour 24 points).

That is a very good balance between the number of points, and the quality of the import, especially when you look at some other fonts:
56 points for Arial
39 points for Segoe Print
52 points for Brush Script MT


Now let's compare the imported a with the scanned image. I've loaded the scanned a into the Background image:

You might want display the Background image in a monochrome color, like I've done below:

Now as a final test, I'm going to print the character and compare that with the original handwritten a. The easiest way to print the character, is through FontCreator's Test window (Font -> Test). You may wonder at what font size I have to print the character. Well here is a formula I used:

On paper character a, height 4 mm = 0.16 inch
Scanned at 600 dpi -> 0.16 * 600 = 96 dots (pixels)
Imported into FontCreator with factor 10 -> 960 units

There are 72 points to an inch, so
Point size = Wanted character height on paper * 72 * (units per em / character height in units).
The units per em used in a font, can be retrieved from Format -> Settings, in our case it is 2048, so
Point size = 0.16 inch * 72 * (2048 / 960) = 24.6 = 25


I scanned in the printed a and placed it right to the handwritten a.

I immediately noticed the printed a was slightly larger, so I decided to print it at point size 24 instead of 25. Here is the scanned result:

In case you are interested, here is a scaled down version (16%) of the last scan. On my 19 inch screen (1280 by 1024 pixels) it looks almost the same size as the originals on paper:

I might write a summary of all findings later this month, but right now I'm curious about your comments.

Posted: Fri Sep 07, 2007 1:10 pm
by Erwin Denissen
You might wonder why I didn't scan the handwritten letter at 300 or 1200 dpi. Well, based on experience I use 300 dpi, but I'll show how images scanned at other resolutions get imported into FontCreator.

My scanner can also scan at other resolutions, e.g. 100 dpi and 200 dpi, but I believe the above shown resolutions will do.

For this test I use the following import image settings:
Threshold value = 96
Smooth filter = Super

I set the multiplier value based on the resolution of the image, keeping the multiply of them at the same value. In this example I make sure Resolution * Multiplier = 4800.
1200 dpi uses multiplier 4
800 dpi uses multiplier 6
600 dpi uses multiplier 8
400 dpi uses multiplier 12
300 dpi uses multiplier 16
150 dpi uses multiplier 32
75 dpi uses multiplier 64

Here are the screenshots of the imported images, all taken at a 15% zoom factor.

Personally I think the 600 dpi scan gives the best result, as it doesn't include the unwanted jagged edges you get with 800 and 1200 dpi, but still has enough similarities with it's original. The result from the 400 dpi isn't too bad, but 300 dpi and lower give poor results.

Posted: Fri Sep 07, 2007 1:50 pm
by Erwin Denissen
Here is a summary of best practices based on the above experiment.

I have written a small Latin letter a on a piece of paper. I actually used plain copier paper and coated paper, but they both give good results with my scanner. I wrote the letter about twice as large as I would have done when writing with a ball point pen. The average stroke width is 1 mm (0.04 inch). The 600 dpi scan gave the best result. So I advise to scan in at 600 dpi when you draw you alphabet with an x-height (the height of the small Latin letter x) of 5 mm (0.2 inch). Scan in at 300 dpi when your x-height is 10 mm (0.4 inch) and scan in at 150 dpi when your x-height is 20 mm (0.8 inch). These numbers are only an indication, I suggest to always experiment with several resolutions, as results also depend on the stroke width of the pen and the quality of the scanner.

If you have special images you want to scan and import, you might need to scan at higher resolutions. For the letter below, hand-drawn at the size of 25 mm (1 inch) we got the best result with a scan at 600 dpi:

Always set the smooth filter to Super.

Earlier on I told you to stay away from the JPEG format, but I no longer worry about that when I scan images. I still stay away from JPEG when designing character outlines in other software, like Adobe Photoshop.

Another opinion

Posted: Fri Sep 07, 2007 11:17 pm
by Dick Pape
I'm not sure I can contribute here as you have done a thorough job analyzing the alternatives.

It would seem however you have lost the artifact in the lower left corner of the round "a" which was present from 300dpi thru 1200dpi -- along with the bleeding on the upper right quadrant. Except in cases of "simple" text or handwriting glyphs you will filter out perhaps important stylistic nuances.

In my efforts to translate early Gothic alphabets I have found myself losing too much of significance with some settings. As this holds also for symbol fonts in general it leads me to a conclusion:

--Have at least two sets of parameters to use depending upon the style, nature and the details in the source document.

One set would be more appropriate when you had simple characters, such as hand printing or text alphabets or small size source and you wanted to smooth out any variations in the stokes. Use small input size, the Super and the rather medium Threshold values. (I'm unfamiliar with the impact of Erode - Dilate and Import Mode settings.)

The second set would be useful for more complicated initials, elaborate script fonts or symbol fonts where you might have and need more detail. In complicated fonts the goal is to faithfully reproduce the source image without regard to the number of points generated so you should use largest input size and None filter and perhaps very low Threshold settings. You want those "ancient" edges to show.

I have found input size is also as important as Threshold, and Smooth Filter parameters. So depending upon the source I will try to expand input 10 fold to maintain small bits of "color" - 720pts versus your 72pt images. I have used full-screen size letters where every detail is there. It is blurry and generally not apparently usable but "works" when it gets into FC through the Import function.

Generally, I keep as much detail and size as possible through the entire input phase until the letter gets into FC and then resize it appropriately. Obviously if you lose details anywhere along the way they won't be in the font at the end and there is nothing FC can do to add missing points.

You have to forget the number of points in a glyph if you don't have the image correctly stated so consider the source before you convert.

Posted: Sat Sep 08, 2007 7:54 am
by Erwin Denissen
Hi Dick,
Dick wrote:It would seem however you have lost the artifact in the lower left corner of the round "a" which was present from 300dpi thru 1200dpi -- along with the bleeding on the upper right quadrant. Except in cases of "simple" text or handwriting glyphs you will filter out perhaps important stylistic nuances.
Personally I consider that artifact an error that needed to be fixed. The Super smooth filter did it for me. But I certainly agree, if you want to keep the artifacts, don't smooth the imported image. If you want to soften the edges a bit, set the Smooth Filter to Smooth. In fact the image of the hand-drawn small Latin character a, drawn with crosshatch lines was best imported this with this setting.

We haven't discussed pixel fonts in this thread, but those need other settings, e.g. Import Mode set to Pixels. With this setting the image dimension can be very small, even 6x6 does work. However, I suggest you manually edit your scanned images, before using importing them as pixel outlines.

Re: Import Images the Right Way (Size Does Matter!)

Posted: Fri Jun 24, 2016 8:16 am
by Bhikkhu Pesala
FontCreator 10 added a new feature to scale bitmaps prior to tracing them.

If the image is too small, a warning will show recommending the use of a higher resolution source image. If you don't have one, FontCreator can scale it by up to 400% before tracing it.

Conversely, if the image is too big for FontCreator to handle, it can scale it down.