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

1

11

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

Impeachable answered 23/2, 2012 at 9:45 Comment(2)
Can I ask why Cairo, if the imagemagick library is the best tool why switch? Are you just gaining experience with Cairo? Curious...Dieterich
Cairo is much quicker in processing images, especially when there are multiple layers to process. It also aided my PDF requirements more suitably.Impeachable
I
6

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.

Intervocalic answered 12/6, 2012 at 1:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.