Search code examples
herokugraphicsmagickbuildpack

How to install graphicsmagick with freetype support in heroku?


I'm trying to get GraphicsMagick to work on a heroku-20 stack, but am running into issues.

All the buildpacks I could find either were not working on the 20 stack, or if they did, they didn't include freetype support.

My "best try" was using

  • https://github.com/bogini/heroku-buildpack-graphicsmagick
  • https://github.com/heroku/heroku-buildpack-apt

to get at least the gm command to work, however, when trying to apply some text on an image, i run into this error:

 Error: Command failed: gm convert: FreeType library is not available (/usr/share/fonts/type1/gsfonts/n019003l.pfb) [No such file or directory].

Did anyone manage to get this working, or point me to how could I approach this problem?


Solution

  • I faced the same problem. And finally, I solved the problem and now the gm library is working perfectly.

    First, you should make your Heroku stack be: Heroku-18

    by run this in terminal

    $ heroku stack:set heroku-18
    

    Second, you should add these two Buildpack in Heroku:

    https://github.com/DuckyTeam/heroku-buildpack-imagemagick
    
    https://github.com/xerpa/heroku-buildpack-graphicsmagick.git
    

    like this: enter image description here Note: The order is important



    The final Heroku project settings must be like this:

    enter image description here