Skip to content

miyako/4d-plugin-data-matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 

Repository files navigation

version platform license downloads

4d-plugin-data-matrix

Barcode generator based on libdmtx 0.7.5.

Syntax

miyako.github.io

  • 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

$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")