Question

Adding an attribute text to my QR Code PNG

  • 29 September 2017
  • 9 replies
  • 12 views

Badge +10

Using the GOQRCodeGenerator transformer I can write the output into a PNG writer. It works very well. However, I wanted to add one of the attributes below the QRCode so each code can be added to the right bin. How do I add this attribute with the raster before it writes to PNG. I've tried TextAdder, rastermosaicker and I have not gotten it to work.


9 replies

Userlevel 4
Badge +30

Hello.

What information do you want to add?

I haved created one with geolocalization before.

Thanks.

Danilo

Badge +10

It's an attribute from the feature with feature type oracle non-spatial.Same attribute that goes to the qr code.

Userlevel 2
Badge +17

Hi @salvaleonrp,

This can be done by creating a separate image of the attribute, moving it just below the QR code, then mosaicking them together.

To create the attribute image, use a TextAdder to create the text from the attribute, then a TextStroker to convert the text to polygons.

Use an ImageRasterizer to create the attribute image, setting the image width to the same as that used in the GOQRCodeGenerator.

Next, use a RasterGeoreferencer to set the upper left X,Y to match the lower left X,Y of the QR code image - if you set the QR image size to 200, the lower left will be at 0,-200.

Finally, send both images to the RasterMosaicker to combine them.

I have attached a simple workspace to illustrate the process: labelqr.fmw

Userlevel 4
Badge +30

Hi @salvaleonrp,

This can be done by creating a separate image of the attribute, moving it just below the QR code, then mosaicking them together.

To create the attribute image, use a TextAdder to create the text from the attribute, then a TextStroker to convert the text to polygons.

Use an ImageRasterizer to create the attribute image, setting the image width to the same as that used in the GOQRCodeGenerator.

Next, use a RasterGeoreferencer to set the upper left X,Y to match the lower left X,Y of the QR code image - if you set the QR image size to 200, the lower left will be at 0,-200.

Finally, send both images to the RasterMosaicker to combine them.

I have attached a simple workspace to illustrate the process: labelqr.fmw

Thanks @DaveAtSafe,

 

Powerful Workspace.

 

Badge +10

Hi @salvaleonrp,

This can be done by creating a separate image of the attribute, moving it just below the QR code, then mosaicking them together.

To create the attribute image, use a TextAdder to create the text from the attribute, then a TextStroker to convert the text to polygons.

Use an ImageRasterizer to create the attribute image, setting the image width to the same as that used in the GOQRCodeGenerator.

Next, use a RasterGeoreferencer to set the upper left X,Y to match the lower left X,Y of the QR code image - if you set the QR image size to 200, the lower left will be at 0,-200.

Finally, send both images to the RasterMosaicker to combine them.

I have attached a simple workspace to illustrate the process: labelqr.fmw

@DaveAtSafe, thanks for the sample it got me moving forward. In my workspace I have to add a VertexCreator before the featurecolorsetter to insert a geometry to the TextAdder. So my workspace worked but the raster results were not very encouraging - too pixelized.

 

 

Userlevel 4
Badge +30
@DaveAtSafe, thanks for the sample it got me moving forward. In my workspace I have to add a VertexCreator before the featurecolorsetter to insert a geometry to the TextAdder. So my workspace worked but the raster results were not very encouraging - too pixelized.

 

 

 

Hi, could you share your workspace?
Userlevel 2
Badge +17
@DaveAtSafe, thanks for the sample it got me moving forward. In my workspace I have to add a VertexCreator before the featurecolorsetter to insert a geometry to the TextAdder. So my workspace worked but the raster results were not very encouraging - too pixelized.

 

 

Hi @salvaleonrp,

 

In the ImageRasterizer you can enable Anti-Aliasing. This will smooth the text rendering for you.

 

Badge +10

@DaveAtSafe I'm back at this project and the sample workspace does not work anymore. It errors out on the RasterMosaicker,

RasterMosaicker(RasterMosaicFactory): All input rasters must have the same number of selected bands. The raster '1' has '4' selected bands, but the mosaicked raster '0' has '1' selected bands

Any suggestions for me to fix?

What I'm trying to do is add whitespace of about 10 pixels on each side of the QRcode so that the user will not mistakenly scan the QR code above or below it. The user needs space on the QR Codes that are being printed on 8.5 x 11 sheets.

The image below was created using an HTMLReportGenerator/HTML Layouter/HTML writer. If I could add an HTML tag TR after each feature then that would solve the problem but that's not an option for the HTML transformers. My next option is to manipulate the QR Code PNG file itself.

Userlevel 2
Badge +17

@DaveAtSafe I'm back at this project and the sample workspace does not work anymore. It errors out on the RasterMosaicker,

RasterMosaicker(RasterMosaicFactory): All input rasters must have the same number of selected bands. The raster '1' has '4' selected bands, but the mosaicked raster '0' has '1' selected bands

Any suggestions for me to fix?

What I'm trying to do is add whitespace of about 10 pixels on each side of the QRcode so that the user will not mistakenly scan the QR code above or below it. The user needs space on the QR Codes that are being printed on 8.5 x 11 sheets.

The image below was created using an HTMLReportGenerator/HTML Layouter/HTML writer. If I could add an HTML tag TR after each feature then that would solve the problem but that's not an option for the HTML transformers. My next option is to manipulate the QR Code PNG file itself.

Hi @salvaleonrp,

 

You may need to set the Interpretation Type in the ImageRasterizer to Gray8.

 

Reply