Need some help with node-red-contrib-image-tools

Hi Folks, Steve,

I'm trying to use node-red-contrib-image-tools to create a label to be output to a Dymo LabelWriter 450.

After some head scratching a couple of days ago I managed to get my pi 3B talking to the Dymo printer over USB.

This morning I've been playing some more and have a label template with company logo on it (png file) to which I add text to, that's all working good.

Next I need to add a Code39 barcode . . . so I downloaded a TTF code39 font and added it. This is where I'm struggling . . . are TTF fonts supported ? the notes say . .

"(Required) font to print. NOTE: This can be one of the presets or the path to a fnt file"

. . . is " . . . fnt file" a typo or does it literally mean an old Windows type font format ? I tried passing the path to my font, not 100% sure I did that right (I'm a Windows person not Linux ) and I did that by storing it in a flow variable (flow.font) and then using that in the font|str property (see below)

The path to my font file was: /usr/share/fonts/truetype/code39/fre3of9x.ttf

I try not to ask for help until I've made a good effort at resolving issues myself . . . I've managed to get most of the way, just need to sort adding the barcode.

cheers,

Simon

Sorry, one other question . . . how/where do I set the size of the font ?

Unfortunately the underlying library doesn't support TrueType fonts. Only bitmap based fnt fonts.

To add barcodes you need a node that generates an image and then you composite it or blit it onto your image.

I have (in a local version of image tools) already creating barcodes (including code 39) that plays nicely with imagetools but it's not ready to publish I'm afraid.

Hi Steve,

thanks for the very quick reply. So if I can find a Code 39 bitmap font at the right size that should work . . . cool, I'll get searching.

Well that wasn't so simple . . . turns out it's not just a good old Windows type Bitmap font . . .
Some info here: Home · libgdx/libgdx Wiki · GitHub
and https://dbotmaker.io/forums/threads/convert-normal-fonts-to-fnt-to-use-with-dbm.211/

I couldn't get Hiero to work so used this: BMFont - AngelCode.com instead and finally managed to convert my TTF to a PNG Bitmap font.

Have a little issue with the font not wanting to print as big as it should be but it's getting late now . . .

So when creating the Bitmap font I was making it bigger gradually to fit my available label space, but it didn't seem to be getting bigger on the label. I found the cause, it seems to be a caching type issue. If I overwrite the font with the same name and path it doesn't update on the label.

Yes, if I remember right, they are cached. You would need to restart node-red to reload a fnt

Hi Steve,

I've just created a few different size options with the size as a suffix to the font name, now when I change the font name it updates correctly on my label.

So I have code39-80.fnt, code39-90.fnt, etc. I'm sure you get the idea.

Thanks for the help and for your node . . .

1 Like

Hi @RaptorUK

I have now published V2.x of image-tools and barcode generation is finally finished.

kCGaUd0gI2

It is possible to set many aspects of the barcode for example...

3 Likes

Very nice, I'm almost finished the hardware debugging part of my project so will be moving on to the Node Red side more during the next few weeks. I'll let you know how I get on and if I have any issues or other feedback.

Thanks again. :+1:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.