Firebase Functions Add Text Over Image

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
Levy4u
Posts: 2
Joined: 2019-01-24T15:09:46-07:00
Authentication code: 1152

Firebase Functions Add Text Over Image

Post by Levy4u »

Hello,

I feel like i've tried every single option (label, draw, annotate) for adding text over an image and I just can't get the text to appear. Here is my test code. I'm getting the newly created image but it ends up just being a copy of the original with no added text. I've tried the sample codes for making thumbnails, adding vignette, etc and those all work...i just can't get the dang text to appear. I'm using node and firebase functions.

('convert', [tempFilePath,
'-fill', 'blue',
'-stroke', 'white',
'-font', 'Candice',
'-pointsize', '30',
'-gravity', 'center',
'-annotate','0', '"Anthony"',
tempFilePath])

This code above creates a copy of the starting image but with no text added.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Firebase Functions Add Text Over Image

Post by snibgo »

What version of IM? What are "node and firebase functions"?

Does the command work at the command line? If so, I suggest you simplify the command you showed, eg fewer quotes around Anthony, no font, etc.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Firebase Functions Add Text Over Image

Post by fmw42 »

I do not know your tool, but I think you need two offset values.

('convert', [tempFilePath,
'-fill', 'blue',
'-stroke', 'white',
'-font', 'Candice',
'-pointsize', '30',
'-gravity', 'center',
'-annotate','0', '0', '"Anthony"',
tempFilePath])

Please always provide your Imagemagick version and Platform/OS. Can you try in the command line? What delegates do you have installed with Imagemagick? Does it include freetype?

Try using the full path to Candice or be sure that Candice is listed in your type.xml file.

Do you get any error message?
Levy4u
Posts: 2
Joined: 2019-01-24T15:09:46-07:00
Authentication code: 1152

Re: Firebase Functions Add Text Over Image

Post by Levy4u »

I apologize in that I don't know to access this via CLI. I am using Google's Firebase platform for mobile development. They have a cloud based backend code "server" that runs certain functions when triggered. They call it "Firebase Cloud Functions". It's pretty much javascript that gets triggered when a new user is added to the database. The code runs to take a blank membership card and "type" their name in a certain spot, save out a copy with their first and last name appended to the end of the image name. Taking the copy and saving it works. But no text appears.

I tried two offset values and it errors with "Code 1". The way it's written is the only way I could get it to not error out but the text never gets added to the image.

John Signs up for app --> Database triggers Firebase Function to use Image Magick to put their name on a blank digital card --> Membership_Blank.png --> John's name get added --> Membership_John.png

I can't find an ImageMagick version but in the Google Firebase Docs it says "Cloud Functions provide an image-processing program called ImageMagick that can perform manipulations on graphical image files.". And that's all I can find about the version.

To recap, Google Firebase Cloud Functions has ImageMagick built in and I am just passing the parameters to it and getting the results. My image is successfully copied to the new location but without the user name added (no errors or anything).
Post Reply