I use zxing to create barcodes with different types (EAN, 2of5 and DataMatrix). Generation generally works fine. The only problem I'm currently facing is that zxing only generates a 14x14 pixel bitmap, which is too small. But only when using DataMatrix! EAN13, 2of5 / ITF and QR codes work with the same code.
My code is:
BitMatrix bitMatrix = new DataMatrixWriter().encode(message, BarcodeFormat.DATA_MATRIX, 1080, 1080, null); int height = bitMatrix.getHeight();
As you can imagine, this looks pretty crap on a 1080p screen such as link 5. Am I getting something wrong? Do I need to make some special settings for DataMatrix?
Google and Stackoverflow could not help me since I cannot find examples of using DataMatrix

Update Here's how I convert bitmaps to bitmaps
int width = bitMatrix.getWidth(); int height = bitMatrix.getHeight(); int[] pixels = new int[width * height]; // All are 0, or black, by default for (int y = 0; y < height; y++) { int offset = y * width; for (int x = 0; x < width; x++) { pixels[offset + x] = bitMatrix.get(x, y) ? BLACK : WHITE; } } Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
If I use any other values ββfor height, I get an OutOfBoundsException, which is pretty obvious (I did not expect anything) ...
When I try to scale the image and set a fixed width and height, the barcode is scanned but looks like crap. This is also obvious, since the bit matrix is ββonly 14x14 instead of the size I specified.

Is there an easy way to scale the bit matrix somehow? Because it consists only of points, therefore it should be possible, but I do not want to calculate it myself. I could not find any documentation for bitmatrix except stackoverflow, and that didn't help me at all.
If I pass MinWidth or MaxWidth to the encoder via HintMap, the application always crashes with an Exception. HintMap (mWidth is the width of the device screen, but I tried several values): Hint Hashtable = new Hashtable ();
hintMap.put(EncodeHintType.MIN_SIZE, new Dimension(mWidth, mWidth)); hintMap.put(EncodeHintType.MAX_SIZE, new Dimension(mWidth, mWidth)); hintMap.put(EncodeHintType.DATA_MATRIX_SHAPE, SymbolShapeHint.FORCE_SQUARE);
An exception:
java.lang.IllegalArgumentException: Can't find a symbol arrangement that matches the message. Data codewords: 7
This last issue seems to me a bug in zxing. I do not understand why the generation does not work if I change the size.