I wrote:

RasterizeWord[word_, font_, size_] := 
Rasterize[Style[word, FontFamily -> font, Black],RasterSize -> size,Background -> Gray] 
f=RasterizeWord["A", "Arial", 20]

and I got (after zoom):

enter image description here

with 18 pixels (easy to calculate). Why??

How to make it the grayscale?

I set antialising to none in Unity Tweak Tool (Linux) and I got:

enter image description here

So I tried:

RasterSize -> size, ImageSize -> size

I got the same result. But it is interesting that in GIMP:

enter image description here

when I Export["f.png", f]. I think something is wrong with the zoom.

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Nov 6, 2014 at 16:06
  • $\begingroup$ You could disable subpixel antialiasing in your OS's text rendering settings. $\endgroup$
    – Szabolcs
    Nov 6, 2014 at 16:07
  • $\begingroup$ Replace RasterSize by ImageSize, you will get the correct width, see also recent mathematica.stackexchange.com/questions/64758/… $\endgroup$ Nov 6, 2014 at 16:10
  • $\begingroup$ Thanks Alexey, but it is not true. $\endgroup$
    – ZYX
    Nov 6, 2014 at 16:59
  • $\begingroup$ @ZYX, on my system (MMA 10, Ubuntu 14), your code < Rasterize["A", RasterSize -> 20] // ImageDimensions > gives {9,18} . If you call instead < Rasterize["A", ImageSize -> 20] // ImageDimensions > , you get {20,34} on my configuration. Please, let me know, if you get a different result. $\endgroup$ Nov 6, 2014 at 17:02


Browse other questions tagged or ask your own question.