I am working on a project that needs rasterizing of drawings into image files. I have already got it work using GDI+. Wanting to create a portable solution, I am also looking into other solutions and found two - cairo and imagemagick. I am new to both, but it seems that ImageMagick can do almost all the stuff - drawing lines, arcs, circles, text etc.. plus many bitmap manipulation.
However, Cairo is mentioned as competitor to GDI+ in web sites. ImageMagick is never mentioned for this purpose.
I do not have time to invest on both libraries. I need to decide which one is worthy. I prefer to ImageMagick, as it seems much more powerful.
What's your opinio开发者_如何学JAVAn on the two graphic libs?
Cairo by itself can't do very much in the way of bitmap manipulation - at least in the sense that ImageMagick can. It is, however, a very powerful vector imaging library, and can do almost everything that GDI+ can do, up to the point where it's practically a suitable replacement for DirectDraw 2D. It can also produce and use bitmap images, and directly supports the PNG image format.
ImageMagick, on the other hand, is a bitmap image library. It has less of a focus on vector graphics than Cairo does, and instead directly produces bitmap representations of vector shapes. On the other hand, it also does a lot Cairo can't do natively, including text rasterization; IM also supports virtually every image format known to Man, and can import and export them with relative ease.
Use Cairo if you need to do scalable vector graphics.
Use ImageMagick if you are ouputting to bitmap or raster formats.
精彩评论