Barcode generator based on libdmtx 0.7.5.
- Uses
libpng
orlibjpeg
to create native images.PNG
offers the best in terms of size and quality, because the colorspace isPNG_COLOR_TYPE_PALETTE
.JPEG
colorspace isJCS_GRAYSCALE
, with quality100
, which is not as small asPNG
.SVG
, by contrast, is large but easier to post-process in 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)
$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")