Best practice for choosing DataMatrix size?

217 views
Skip to first unread message

Rabid Mutant

unread,
Mar 10, 2017, 7:09:26 AM3/10/17
to zxing
Hi,

I don't really care about pixels (1 bit per pixel is fine), but I do care about the aspect ratio of the datamatrix bitmap.

What I would like to do is generate a 3x1 or 4x1 aspect ratio for the datamatrix (or perhaps specify a min & max ratio), but looking through the code I can not see the obvious/correct way to do this for an arbitrary string.

Any suggestions about most reliable and/or best practice would be great.

Thanks!

Lachezar Dobrev

unread,
Mar 13, 2017, 7:05:25 AM3/13/17
to Rabid Mutant, zxing
You can use the EncodeHintType.DATA_MATRIX_SHAPE [1] hint and
request a SymbolShapeHint.FORCE_RECTANGLE [2] as value. That would
make the generated Data Matrix use only one of the Rectangular
matrices. Keep in mind, that there are only 6 rectangular matrix
variants, most are square.

[1] https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/EncodeHintType.java
[2] https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/datamatrix/encoder/SymbolShapeHint.java
[3] https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/datamatrix/encoder/SymbolInfo.java
> --
> You received this message because you are subscribed to the Google Groups "zxing" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages