LoginSignup
0
1

More than 3 years have passed since last update.

python pylibdmtx でdata matrixを作成する

Last updated at Posted at 2019-10-29

インストール

pip install pylibdmtx

data matrixのコード作成

from pylibdmtx.pylibdmtx import encode
from PIL import Image
encoded = encode('Hello World', size='16x16')
img = Image.frombytes('RGB', (encoded.width, encoded.height), encoded.pixels)
img.save('dmtx.png')

encode関数のパラメーターはschemeに以下のパラーメーターを指定できるはずだが、なぜかできない。
誰か教えて下さい。

  • 'Ascii'
  • 'AutoBest'
  • 'AutoFast'
  • 'Base256'
  • 'C40'
  • 'Edifact'
  • 'Text'
  • 'X12'

sizeによって作製できる情報の量が決定される。
sizeには以下のパラメーターを指定できる

  • 'RectAuto'
  • 'SquareAuto'
  • 'ShapeAuto'
  • '10x10'
  • '12x12'
  • '14x14'
  • '16x16'
  • '18x18'
  • '20x20'
  • '22x22'
  • '24x24'
  • '26x26'
  • '32x32'
  • '36x36'
  • '40x40'
  • '44x44'
  • '48x48'
  • '52x52'
  • '64x64'
  • '72x72'
  • '80x80'
  • '88x88'
  • '96x96'
  • '104x104'
  • '120x120'
  • '132x132'
  • '144x144'
  • '8x18'
  • '8x32'
  • '12x26'
  • '12x36'
  • '16x36'
  • '16x48'
0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1