How to overlay graphics on CSV variable text QR codes

We are marking a pair of QR codes on our products using a CSV file which contains the data for both. One is a URL specific to the product serial number, and one is a set of unique WiFi credentials. This is all working as it should.

The QRs are generated with maximum bit redundancy, so we have some freedom to put small symbols in the QR area to help identify for the user what each QR code is for; A question mark for the URL one, and a WiFi symbol for the WiFi credentials one. The question mark one looks like this, for example:

I constructed this by making a filled circle and performing a boolean union with the QR code. I then created the question mark as text and centered it in the circle and performed a boolean intersection. This yields the desired result visually, but since Lightburn does not store a processing chain / timeline like say, Adobe Photoshop, it appears to ā€œfreezeā€ the QR code to whatever variable text it was encoding at that moment you do the boolean operations. If you incremement through the CSV indexes, you can see the untouched WiFi QR code still changes, but this one no longer does.

Is there some way I can still accomplish this, maybe without boolean operations? If for example the software supported alpha channels, masking, or some sort of layer draw order?

LB supports image masing, so it might work if you create the logo as a pixel image and then use image masking. But I don’t know if that would work for your use case..
Alternatively, you could just place the logo on top, on a second layer, then it gets engraved on top of the rest, but this might only work ok for the circle, the question mark might be disturbed by the QR pixels that have been lasered before. So not a great option.

Generate the QR to size

Make a circle of the correct size and position

Use BOOLEAN subtract to ā€œpunch a hole throughā€ the QR tool object.

Place your desired graphic in the hole.

Select QR and interior graphic from grouping.

How does that work for you? I am working on my mental processor (away from laptop, so using my imagination)

Can you do this with a qr code and not loose data..?

How much of the qr code graphic is needed?

I don’t know much about these, but it seems if you take out a piece, you’ll lose a piece of data… Is it built redundant or ?

:smiley_cat:

I will try this, but I think the main issue here is that as soon as you start doing any boolean operations, the QR object ceases to be dynamic and does not change encoding with the variable text. As a software developer myself, I know this can be trickier to accomplish than it seems. The document has to remember the sequence of operations needed to produce the output, not just store the result, which can be a pretty major design change if you have not anticipated the need for this from the start.

Yes, there is an adjustable amount of redundancy in QR codes. You can adjust this in Lightburn and most other applications.

2 Likes

My brain skipped over the variable text part of QR.

Sorry, it’s way over my head now.

Luck To ya and please update this thread when you have success.

I don’t believe there’s any way of achieving the desired output with a non-destructive workflow all within LightBurn, or at least I can’t think of one. The biggest hurdle is in being able to mask or negate the area of the QR code not covered by the symbol. There’s no non-destructive mechanism to be able to handle that as far as I’m aware.

2 Likes

Hi Colby,

@Berainlb is right, unfortunately this is not currently possible.

Based on this topic, your support ticket (with your helpful ideas), and a brief discussion with @LightBurn, I’ve added an internal feature request currently titled;

ā€œQR Code: ability to include a custom internal graphic/logo, while retaining variable text functionalityā€

This could potentially be implemented as a configurable small white circle or square within the QR Code to allow your own graphic to be layered over it.

There is an existing public Fider request for this, which I’d encourage you, along with anybody wanting this to upvote (and please add your comments if you think of any other specific functionality you would like to see):

2 Likes

Thanks for setting up the feature request. We need this for a production environment in the short term, so I can’t wait on the chance a feature might be implemented in the future.

I can’t seem to find this anywhere, but is there a means by which one can load / import bitmap or SVG images using a CSV driven variable text field that is the file path to the image to be loaded? That way I could write my own code to generate the QR codes with overlaid icon images that I need and then just have LightBurn load them sequentially as we mark tens of thousands of items.

I don’t think that is possible with LB. But you could try GRBL-Plotter Releases Ā· svenhb/GRBL-Plotter Ā· GitHub. It can batch-import graphics and some more automations, an example is here:

Thanks. This looks to be G-code based? I need this to operate a 100W JPT MOPA galvo fiber laser with a rotary turntable plugged into it to continuously mark thousands of plastic parts placed and later removed from the 10-position rotary table as it goes around. The laser uses a USB-based BJJCZ board as a controller.

Ah, I didn’t notice. No, then it doesn’t work. It’s only for grbl-based devices.

Another thing you could try is to use the (virtual) array feature of LB to create a set of let’s say 50 qr codes at once, create another array of 50 logos with the same array settings (so each will be positioned correctly, and then do only one boolean operation with both layers. But I’m not sure if you can create qr codes as an array and using csv input..

I did a quick video of what I meant. It does work fast if you can create the qr codes based on CSV, which I never used so far (I don’t know if that works).

ArrayQRCodes

You cannot load an image from the CSV file.

If you need the small symbol to vary dynamically based on the content of each row (if they are mixed up and not able to be batched one symbol type at a time) then for now you could convert your graphic into a character of a custom font, and include it in another column in a unicode supporting csv file.

For example, here I imported a wifi symbol (svg) to replace a character of a basic font using Font Forge. I replaced the ā€˜Frowning face’ glyph as you can see in the character map (but there are plenty of spaces to create your own characters without disturbing the others).

You may not have much space for the QR code, but if you put the symbol to the corner and shrink the QR you will need less error correction so the readability may not suffer.

There is an existing fider request for ā€˜Variable icon/image’ by CSV which has yet to gain much traction - but is what you would otherwise need.

Not this exact approach but you can script LightBurn to open and load a file. More information here:

Not sure how practical this would be for markings tens of thousands of items.

Is having a graphic or text label for the QR code external to the code not an option?

Thanks for the reply:

  • I don’t need to change the icon with the QR code - these are always the same. I have two different codes in this one marking, but they are in different locations and always have the same graphic.
  • I’m relucantant to move this icon to the type of location you suggest for functional reasons. If you read the specs for QR codes, there is a permiter around the code that must remain blank for it to be readable. Normally, I might ignore this warning, but I have actually run into this issue where we were putting a QR code too close to the edges of a part and it was having trouble reading it with a newer iPhone, but still worked OK on Android. Aztec codes do not have this restriction, and there is API support for reading them in iOS, but the camera app doesn’t automatically recognize them so it is a deal-killer.

The UDP control is interesting, also an odd choice that they use UDP instead of TCP/IP for controlling something important with safety implications like a laser. I don’t know if there is enough functionality here to fire the laser and advance the turntable programmatically?

This may have been originally chosen to match Ruida communication as that’s also done using UDP but I have no insight into this. Communication between LightBurn and LightBurn Bridge, in contrast, is done with TCP.

I don’t believe any of those are available through UDP at least discretely. I believe you can ā€œStartā€ a job but no access to individual functions.