datenimperator
datenimperator

Reputation: 308

How to create a PNG file with text on it?

From a Ruby app, I need to dynamically create an image file in memory. I'd prefer PNG files so I looked at chunky_png first. It'd allow me to manipulate PNG images and do a little drawing on the canvas. It does not allow me to render text as pixels, though.

What's the best way to do that?

Any hint is greatly appreciated.

Upvotes: 3

Views: 2070

Answers (1)

Michaël Witrant
Michaël Witrant

Reputation: 7714

You can use RMagick (doc). Note that it may be difficult to install because it requires ImageMagick libraries (unlike chunky_png which is pure Ruby).

Once installed, you may use the annotate method or the vector drawing module RVG (with the text method used in the tutorial).

Upvotes: 5

Related Questions