Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get gm to switch fonts #565

Open
mayeaux opened this issue Aug 10, 2016 · 4 comments
Open

Can't get gm to switch fonts #565

mayeaux opened this issue Aug 10, 2016 · 4 comments

Comments

@mayeaux
Copy link

mayeaux commented Aug 10, 2016

I am trying to use this script to write out something on a photo. It's working properly, however, I can't get the font to change, even though I am using an example straight from the docs. I have ghostscript installed and if I run

$ convert -list font

I see a large amount of fonts, but even using those in the below fashion doesn't do anything. Any ideas on what I'm doing wrong?

   gm('./photoRealistic.png')
      .fill('#000000')
      .font("Helvetica.ttf", 30)
      .drawText(0, 250, "Hello!")
      .write("./drawing2.jpg", function (err) {
        if(err) console.log(err);
        if (!err) console.log('done');
      });
@jaladankisuresh
Copy link

Any solution or work around to this?

@glenswift
Copy link

glenswift commented Mar 15, 2017

Replacing

const gm = require('gm');

with

const gm = require('gm').subClass({imageMagick: true});

helped me.

@smwbtech
Copy link

I got the same problem. I'm tried out different fonts, but result is the same.

gm('./public/img/pattern-changed.jpg')
.font('Arial.ttf', 16)
.drawText(300, 39, ${obj.article})
.drawText(300, 58, ${obj.size})
.drawText(12, 100, obj.title.match(/женская/) ? 'футболка женская' : 'футболка мужская' )
.drawText(12, 455, ${obj.title})
.write(./public/upload/${obj.barcode}.jpg, (err) => {
if (!err) {
console.log('done');
}

@Aung-Myint-Thein
Copy link

You need to add the fonts to imageMagick's xml file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants