Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get better anti-aliasing results in Cairo (examples shown)

Building a project using Cairo for graphics processing. Neither of the anti-aliasing options produce a good enough result. I'm using an ARGB32 surface and writing to png.

I have tried using all of the hinting styles but I can see no change in the result.

The best option for text on both white and black will be option 4 but as you can see, it's still not as nice as an output produced from the imagemagick library in example 5.

Any input or suggestions welcome.

1. Using 'ANTIALIAS_DEFAULT'

example 1

2. Using 'ANTIALIAS_NONE'

example 2

3. Using 'ANTIALIAS_GRAY'

example 3

4. Using 'ANTIALIAS_SUBPIXEL'

axample 4

5. Using Imagemagick and it's default anti-aliasing

example 5

like image 330
digout Avatar asked Feb 23 '12 09:02

digout


1 Answers

If you are stuck with Cairo, a workaround would be manual supersampling. Basically render it at a larger resolution (twice or 4 times the width and height), and then resize it to the correct size.

like image 130
Sarke Avatar answered Sep 21 '22 16:09

Sarke