Saturday, January 28, 2017

Text Engine for the Backend Which Outputs an Image

Leave a Comment

I am looking for a server-side text engine which can generate images with the specified text. I have experience with CoreText on iOS, and I am looking for a similar text layout and rendering engine to use on a server. Ideally this is open source and could be run on Linux.

2 Answers

Answers 1

You don't specify many requirements regarding what kind of input and output you need, but a (La)TeX to image server should fit the requirement of

server-side text engine which can generate images with the specified text

To that end, you can use mathoid (a node based server).

While LaTeX is usually used for math-related typesetting, it can be used to typeset arbitrary text and results in very high-quality output.

There are other command-line utilities that convert LaTeX to images, but those would need to be wrapped in a server somehow. For example tex2png.

Answers 2

A simple solution is using gd (and here), which has a command-line utility called fly allowing you to describe an image in terms of simple primitives (line, rectangle, colour) and include text using TrueType fonts.

If this is to be integrated into, say, a Webserver, then e.g. PHP has bindings for GD2 and can be used straight away.

A more typesetting-oriented approach could be Sile.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment