E
E
evilandfox2016-03-05 06:55:27
JavaScript
evilandfox, 2016-03-05 06:55:27

Rendering of Cyrillic text on node.js gm (graphicsMagick) gives krakozyabry. How to fix?

The module graphicsMagick"ported" to nodeJs is used ( aheckmann.github.io/gm/).
You need to open an image, overlay Russian text on it, save it under a new name:

const gm = require('gm');
gm('image.png')
  .font("Lato-Regular.ttf", 36)
  .fill('#333')
  .drawText(200, 40, 'Кирилличекский текст')
  .write('result.png', (err) => {
    if (err) console.log(err);
  });

As a result, I get:
58fd4c340d954da8a0e6585d6ebfe34e.png
As I read ( https://habrahabr.ru/post/147843/) , this is due to the fact that Cyrillic text in windows-1251 encoding is read as if it were windows-1252 encoding.
How to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Shatokhin, 2016-03-05
@evilandfox

windows platform? In stdin / out, the conversion curve automatically takes place.
ps Perhaps the command "chcp 65001" (switch to UTF-8) will help, but it's not clear how to execute it in the same session with gm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question