https://github.com/miyako/4d-plugin-data-matrix
Barcode generator based on libdmtx 0.7.5.
https://github.com/miyako/4d-plugin-data-matrix
4d-plugin barcode-generator
Last synced: 3 days ago
JSON representation
Barcode generator based on libdmtx 0.7.5.
- Host: GitHub
- URL: https://github.com/miyako/4d-plugin-data-matrix
- Owner: miyako
- License: mit
- Created: 2015-11-17T18:37:52.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-06-06T22:49:16.000Z (about 4 years ago)
- Last Synced: 2025-02-26T04:19:08.759Z (over 1 year ago)
- Topics: 4d-plugin, barcode-generator
- Language: C
- Homepage:
- Size: 25.7 MB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


[](LICENSE)

# 4d-plugin-data-matrix
Barcode generator based on [libdmtx 0.7.5](https://github.com/dmtx/libdmtx).
### Syntax
[miyako.github.io](https://miyako.github.io/2019/08/17/4d-plugin-data-matrix.html)
* Uses ``libpng`` or ``libjpeg`` to create native images. ``PNG`` offers the best in terms of size and quality, because the colorspace is ``PNG_COLOR_TYPE_PALETTE``. ``JPEG`` colorspace is ``JCS_GRAYSCALE``, with quality ``100``, which is not as small as ``PNG``. ``SVG``, by contrast, is large but easier to post-process in 4D.
## Examples
```4d
$moduleSize:=2
$margin:=2
$DPI:=96
$data:="" //out param (svg source code)
$value:="18000000011522042528120000355250541000002277743896"
$image:=DMTX ($value;DMTX Format PNG;DMTX Scheme ASCII;$moduleSize;DMTX Symbol 16x48;$margin;$DPI;$data)
$image:=$image/$image/$image/$image
$text:=DMTX Read image ($image;$texts)
```
```4d
$moduleSize:=2
$margin:=2
$DPI:=96
$data:=""
$value:="18000000011522042528120000355250541000002277743896"
$image:=DMTX ($value;DMTX Format JPG;DMTX Scheme ASCII;$moduleSize;DMTX Symbol 16x48;$margin;$DPI;$data)
$jpg_size:=Picture size($image) //4,701 (not as small because it is grayscale)
$jpg_base64_size:=Length($data) //6,355
WRITE PICTURE FILE(System folder(Desktop)+"sample_dmtx.jpg";$image;".jpg")
$image:=DMTX ($value;DMTX Format PNG;DMTX Scheme ASCII;$moduleSize;DMTX Symbol 16x48;$margin;$DPI;$data)
$png_size:=Picture size($image) //314 (very small because we use palette)
$png_base64_length:=Length($data) //425
WRITE PICTURE FILE(System folder(Desktop)+"sample_dmtx.png";$image;".png")
$image:=DMTX ($value;DMTX Format SVG;DMTX Scheme ASCII;$moduleSize;DMTX Symbol 16x48;$margin;$DPI;$data)
$svg_size:=Picture size($image) //260,594 (very large because it is text)
$svg_xml_length:=Length($data) //260,594
WRITE PICTURE FILE(System folder(Desktop)+"sample_dmtx.svg";$image;".svg")
```