Question

I'm rendering text to a PNG using ImageMagick's convert -annotate command. Now I want to reduce the kerning, i.e. spacing between the letters. This can be done in IM using an option like -kerning -2.

Unfortunately, this option completely overrides the default kerning of the font, so that now the bounding boxes of all letters have the same distance, even in cases like the letter combination "AV", where they should overlap.

Is there a way to make IM apply the default kerning first, but decrease the resulting spacing by e.g. 2px, instead of using the same spacing everywhere?

Failing that, are there alternative command line (or Ruby) tools that can render text in a custom font to PNG while supporting the desired behaviour?

Was it helpful?

Solution

If you have a later version of Imagemagick > 6.7.6-3 there is a new feature ( I think it will only work on Linux machines ) which might be able to do what you want. I have not checked it out: http://www.imagemagick.org/Usage/text/#pango

OTHER TIPS

This issue has been fixed in ImageMagick 6.8.9-6 Beta.

It's a bit more work to set up, but of late I've been advocating to people wanting to do server-side document rendering to build them in SVG and convert them to bitmap using Inkscape. I'd be pretty sure that this feature is supported (get yourself a copy and check that out in the UI - if it's in there, you can do it).

You'd need to be confident in manipulating XML docs - and basic SVG is pretty easy to learn once you get into it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top