zxing-cpp 3.1.0__cp310-cp310-win_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ Metadata-Version: 2.4
2
+ Name: zxing-cpp
3
+ Version: 3.1.0
4
+ Summary: Python bindings for the zxing-cpp barcode library
5
+ Keywords: barcode
6
+ Author-Email: zxing-cpp community <zxingcpp@gmail.com>
7
+ License-Expression: Apache-2.0
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Multimedia :: Graphics
13
+ Project-URL: Homepage, https://github.com/zxing-cpp/zxing-cpp
14
+ Project-URL: Repository, https://github.com/zxing-cpp/zxing-cpp.git
15
+ Project-URL: Issues, https://github.com/zxing-cpp/zxing-cpp/issues
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+
19
+ # Python bindings for zxing-cpp
20
+
21
+ [![PyPI](https://img.shields.io/pypi/v/zxing-cpp.svg)](https://pypi.org/project/zxing-cpp/)
22
+
23
+ The package uses [scikit-build-core](https://scikit-build-core.readthedocs.io/) as its build backend and [nanobind](https://nanobind.readthedocs.io/) for the Python bindings.
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install zxing-cpp
29
+ ```
30
+
31
+ To build from a checked out / extracted soruce tree, a suitable [build environment](https://github.com/zxing-cpp/zxing-cpp#build-instructions) including a C++20 compiler is required:
32
+
33
+ ```bash
34
+ pip install .
35
+ ```
36
+
37
+
38
+ ## Usage
39
+
40
+ ### Reading barcodes
41
+
42
+ ```python
43
+ import cv2, zxingcpp
44
+
45
+ img = cv2.imread('test.png')
46
+ barcodes = zxingcpp.read_barcodes(img)
47
+ for barcode in barcodes:
48
+ print('Found barcode:'
49
+ f'\n Text: "{barcode.text}"'
50
+ f'\n Format: {barcode.format}'
51
+ f'\n Content: {barcode.content_type}'
52
+ f'\n Position: {barcode.position}')
53
+ if len(barcodes) == 0:
54
+ print("Could not find any barcode.")
55
+ ```
56
+
57
+ ### Writing barcodes
58
+
59
+ ```python
60
+ import zxingcpp
61
+ from PIL import Image
62
+
63
+ barcode = zxingcpp.create_barcode('This is a test', zxingcpp.BarcodeFormat.QRCode, ec_level = "50%")
64
+
65
+ img = barcode.to_image(scale = 5)
66
+ Image.fromarray(img).save("test.png")
67
+
68
+ svg = barcode.to_svg(add_quiet_zones = False)
69
+ with open("test.svg", "w") as svg_file:
70
+ svg_file.write(svg)
71
+ ```
72
+
73
+ To get a full list of available parameters for `read_barcodes` and `create_barcode` as well as the properties of the Barcode objects, have a look at the `nanobind` module definition in [this C++ source file](https://github.com/zxing-cpp/zxing-cpp/blob/master/wrappers/python/zxing.cpp).
@@ -0,0 +1,7 @@
1
+ zxingcpp/__init__.py,sha256=HBB4r-6Pk427uBJRdI1J4rSmWC6S6yIQO1ik3q0BSN4,193
2
+ zxingcpp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ zxingcpp/zxingcpp.cp310-win_arm64.pyd,sha256=hspYeovAvhTb4425QhbJyuT4_mg2QUWpueXhauqWHgk,1677824
4
+ zxingcpp/zxingcpp.pyi,sha256=1Kq6WoIexcDtWtWPvJAf8HApFN61z9peFiUSM27zZro,20263
5
+ zxing_cpp-3.1.0.dist-info/METADATA,sha256=oAGzW6W2LklFGRpwL1eWRLmXZQji21HCfJgU8UgOAx8,2322
6
+ zxing_cpp-3.1.0.dist-info/WHEEL,sha256=KsNLhKYEOIlb4YJBw1wsymDO0UFzyob_Up3ZB-Kabug,105
7
+ zxing_cpp-3.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: scikit-build-core 1.0.0
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-cp310-win_arm64
5
+
zxingcpp/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ # Re-export the native module for 'import zxingcpp' compatibility.
2
+ # Named init.py instead of __init__.py to avoid import conflicts when running from this directory.
3
+ from .zxingcpp import *
zxingcpp/py.typed ADDED
File without changes
Binary file
zxingcpp/zxingcpp.pyi ADDED
@@ -0,0 +1,717 @@
1
+ """python bindings for zxing-cpp"""
2
+
3
+ from collections.abc import Iterator, Sequence
4
+ import enum
5
+ from typing import Annotated, TypeAlias, overload
6
+
7
+ from numpy.typing import NDArray
8
+
9
+
10
+ class BarcodeFormats:
11
+ @overload
12
+ def __init__(self, arg: BarcodeFormat, /) -> None: ...
13
+
14
+ @overload
15
+ def __init__(self, arg: Sequence[BarcodeFormat], /) -> None: ...
16
+
17
+ def __repr__(self) -> str: ...
18
+
19
+ def __eq__(self, arg: BarcodeFormats, /) -> bool: ...
20
+
21
+ def __or__(self, arg: BarcodeFormat, /) -> BarcodeFormats: ...
22
+
23
+ def __len__(self) -> int: ...
24
+
25
+ def __iter__(self) -> Iterator[BarcodeFormat]: ...
26
+
27
+ def __getitem__(self, arg: int, /) -> BarcodeFormat: ...
28
+
29
+ class BarcodeFormat(enum.IntEnum):
30
+ """Enumeration of zxing supported barcode formats"""
31
+
32
+ def __str__(self) -> str: ...
33
+
34
+ None = 0
35
+
36
+ All = 10794
37
+
38
+ AllReadable = 29226
39
+
40
+ AllCreatable = 30506
41
+
42
+ AllLinear = 27690
43
+
44
+ AllMatrix = 27946
45
+
46
+ AllGS1 = 18218
47
+
48
+ AllRetail = 21034
49
+
50
+ AllIndustrial = 18730
51
+
52
+ Codabar = 8262
53
+
54
+ Code39 = 8257
55
+
56
+ Code39Std = 29505
57
+
58
+ Code39Ext = 25921
59
+
60
+ Code32 = 12865
61
+
62
+ PZN = 28737
63
+
64
+ Code93 = 8263
65
+
66
+ Code128 = 8259
67
+
68
+ ITF = 8265
69
+
70
+ ITF14 = 13385
71
+
72
+ DataBar = 8293
73
+
74
+ DataBarOmni = 28517
75
+
76
+ DataBarStk = 29541
77
+
78
+ DataBarStkOmni = 20325
79
+
80
+ DataBarLtd = 27749
81
+
82
+ DataBarExp = 25957
83
+
84
+ DataBarExpStk = 17765
85
+
86
+ EANUPC = 8261
87
+
88
+ EAN13 = 12613
89
+
90
+ EAN8 = 14405
91
+
92
+ EAN5 = 13637
93
+
94
+ EAN2 = 12869
95
+
96
+ ISBN = 26949
97
+
98
+ UPCA = 24901
99
+
100
+ UPCE = 25925
101
+
102
+ Telepen = 8258
103
+
104
+ TelepenAlpha = 12354
105
+
106
+ TelepenNumeric = 12610
107
+
108
+ OtherBarcode = 8280
109
+
110
+ DXFilmEdge = 30808
111
+
112
+ PDF417 = 8268
113
+
114
+ CompactPDF417 = 25420
115
+
116
+ MicroPDF417 = 27980
117
+
118
+ Aztec = 8314
119
+
120
+ AztecCode = 25466
121
+
122
+ AztecRune = 29306
123
+
124
+ QRCode = 8273
125
+
126
+ QRCodeModel1 = 12625
127
+
128
+ QRCodeModel2 = 12881
129
+
130
+ MicroQRCode = 27985
131
+
132
+ RMQRCode = 29265
133
+
134
+ DataMatrix = 8292
135
+
136
+ MaxiCode = 8277
137
+
138
+ NONE = 0
139
+
140
+ DataBarExpanded = 25957
141
+
142
+ DataBarLimited = 27749
143
+
144
+ LinearCodes = 27690
145
+
146
+ MatrixCodes = 27946
147
+
148
+ def __or__(self, arg: BarcodeFormat, /) -> BarcodeFormats: ...
149
+
150
+ @property
151
+ def symbology(self) -> BarcodeFormat: ...
152
+
153
+ None: ErrorType = ErrorType.None
154
+
155
+ All: BarcodeFormat = BarcodeFormat.All
156
+
157
+ AllReadable: BarcodeFormat = BarcodeFormat.AllReadable
158
+
159
+ AllCreatable: BarcodeFormat = BarcodeFormat.AllCreatable
160
+
161
+ AllLinear: BarcodeFormat = BarcodeFormat.AllLinear
162
+
163
+ AllMatrix: BarcodeFormat = BarcodeFormat.AllMatrix
164
+
165
+ AllGS1: BarcodeFormat = BarcodeFormat.AllGS1
166
+
167
+ AllRetail: BarcodeFormat = BarcodeFormat.AllRetail
168
+
169
+ AllIndustrial: BarcodeFormat = BarcodeFormat.AllIndustrial
170
+
171
+ Codabar: BarcodeFormat = BarcodeFormat.Codabar
172
+
173
+ Code39: BarcodeFormat = BarcodeFormat.Code39
174
+
175
+ Code39Std: BarcodeFormat = BarcodeFormat.Code39Std
176
+
177
+ Code39Ext: BarcodeFormat = BarcodeFormat.Code39Ext
178
+
179
+ Code32: BarcodeFormat = BarcodeFormat.Code32
180
+
181
+ PZN: BarcodeFormat = BarcodeFormat.PZN
182
+
183
+ Code93: BarcodeFormat = BarcodeFormat.Code93
184
+
185
+ Code128: BarcodeFormat = BarcodeFormat.Code128
186
+
187
+ ITF: BarcodeFormat = BarcodeFormat.ITF
188
+
189
+ ITF14: BarcodeFormat = BarcodeFormat.ITF14
190
+
191
+ DataBar: BarcodeFormat = BarcodeFormat.DataBar
192
+
193
+ DataBarOmni: BarcodeFormat = BarcodeFormat.DataBarOmni
194
+
195
+ DataBarStk: BarcodeFormat = BarcodeFormat.DataBarStk
196
+
197
+ DataBarStkOmni: BarcodeFormat = BarcodeFormat.DataBarStkOmni
198
+
199
+ DataBarLtd: BarcodeFormat = BarcodeFormat.DataBarLtd
200
+
201
+ DataBarExp: BarcodeFormat = BarcodeFormat.DataBarExp
202
+
203
+ DataBarExpStk: BarcodeFormat = BarcodeFormat.DataBarExpStk
204
+
205
+ EANUPC: BarcodeFormat = BarcodeFormat.EANUPC
206
+
207
+ EAN13: BarcodeFormat = BarcodeFormat.EAN13
208
+
209
+ EAN8: BarcodeFormat = BarcodeFormat.EAN8
210
+
211
+ EAN5: BarcodeFormat = BarcodeFormat.EAN5
212
+
213
+ EAN2: BarcodeFormat = BarcodeFormat.EAN2
214
+
215
+ ISBN: BarcodeFormat = BarcodeFormat.ISBN
216
+
217
+ UPCA: BarcodeFormat = BarcodeFormat.UPCA
218
+
219
+ UPCE: BarcodeFormat = BarcodeFormat.UPCE
220
+
221
+ Telepen: BarcodeFormat = BarcodeFormat.Telepen
222
+
223
+ TelepenAlpha: BarcodeFormat = BarcodeFormat.TelepenAlpha
224
+
225
+ TelepenNumeric: BarcodeFormat = BarcodeFormat.TelepenNumeric
226
+
227
+ OtherBarcode: BarcodeFormat = BarcodeFormat.OtherBarcode
228
+
229
+ DXFilmEdge: BarcodeFormat = BarcodeFormat.DXFilmEdge
230
+
231
+ PDF417: BarcodeFormat = BarcodeFormat.PDF417
232
+
233
+ CompactPDF417: BarcodeFormat = BarcodeFormat.CompactPDF417
234
+
235
+ MicroPDF417: BarcodeFormat = BarcodeFormat.MicroPDF417
236
+
237
+ Aztec: BarcodeFormat = BarcodeFormat.Aztec
238
+
239
+ AztecCode: BarcodeFormat = BarcodeFormat.AztecCode
240
+
241
+ AztecRune: BarcodeFormat = BarcodeFormat.AztecRune
242
+
243
+ QRCode: BarcodeFormat = BarcodeFormat.QRCode
244
+
245
+ QRCodeModel1: BarcodeFormat = BarcodeFormat.QRCodeModel1
246
+
247
+ QRCodeModel2: BarcodeFormat = BarcodeFormat.QRCodeModel2
248
+
249
+ MicroQRCode: BarcodeFormat = BarcodeFormat.MicroQRCode
250
+
251
+ RMQRCode: BarcodeFormat = BarcodeFormat.RMQRCode
252
+
253
+ DataMatrix: BarcodeFormat = BarcodeFormat.DataMatrix
254
+
255
+ MaxiCode: BarcodeFormat = BarcodeFormat.MaxiCode
256
+
257
+ class Binarizer(enum.Enum):
258
+ """Enumeration of binarizers used before decoding images"""
259
+
260
+ BoolCast = 3
261
+
262
+ FixedThreshold = 2
263
+
264
+ GlobalHistogram = 1
265
+
266
+ LocalAverage = 0
267
+
268
+ BoolCast: Binarizer = Binarizer.BoolCast
269
+
270
+ FixedThreshold: Binarizer = Binarizer.FixedThreshold
271
+
272
+ GlobalHistogram: Binarizer = Binarizer.GlobalHistogram
273
+
274
+ LocalAverage: Binarizer = Binarizer.LocalAverage
275
+
276
+ class EanAddOnSymbol(enum.Enum):
277
+ """Enumeration of options for EAN-2/5 add-on symbols check"""
278
+
279
+ Ignore = 0
280
+ """Ignore any Add-On symbol during read/scan"""
281
+
282
+ Read = 1
283
+ """Read EAN-2/EAN-5 Add-On symbol if found"""
284
+
285
+ Require = 2
286
+ """Require EAN-2/EAN-5 Add-On symbol to be present"""
287
+
288
+ Ignore: EanAddOnSymbol = EanAddOnSymbol.Ignore
289
+
290
+ Read: EanAddOnSymbol = EanAddOnSymbol.Read
291
+
292
+ Require: EanAddOnSymbol = EanAddOnSymbol.Require
293
+
294
+ class ContentType(enum.Enum):
295
+ """Enumeration of content types"""
296
+
297
+ Text = 0
298
+
299
+ Binary = 1
300
+
301
+ Mixed = 2
302
+
303
+ GS1 = 3
304
+
305
+ ISO15434 = 4
306
+
307
+ UnknownECI = 5
308
+
309
+ Text: ContentType = ContentType.Text
310
+
311
+ Binary: ContentType = ContentType.Binary
312
+
313
+ Mixed: ContentType = ContentType.Mixed
314
+
315
+ GS1: ContentType = ContentType.GS1
316
+
317
+ ISO15434: ContentType = ContentType.ISO15434
318
+
319
+ UnknownECI: ContentType = ContentType.UnknownECI
320
+
321
+ class TextMode(enum.Enum):
322
+ Plain = 0
323
+ """
324
+ bytes() transcoded to unicode based on ECI info or guessed charset (the default mode prior to 2.0)
325
+ """
326
+
327
+ ECI = 1
328
+ """
329
+ standard content following the ECI protocol with every character set ECI segment transcoded to unicode
330
+ """
331
+
332
+ HRI = 2
333
+ """Human Readable Interpretation (dependent on the ContentType)"""
334
+
335
+ Escaped = 3
336
+ """
337
+ Use the EscapeNonGraphical() function (e.g. ASCII 29 will be transcoded to '<GS>'
338
+ """
339
+
340
+ Hex = 4
341
+ """bytes() transcoded to ASCII string of HEX values"""
342
+
343
+ HexECI = 5
344
+ """bytesECI() transcoded to ASCII string of HEX values"""
345
+
346
+ Plain: TextMode = TextMode.Plain
347
+
348
+ ECI: TextMode = TextMode.ECI
349
+
350
+ HRI: TextMode = TextMode.HRI
351
+
352
+ Escaped: TextMode = TextMode.Escaped
353
+
354
+ Hex: TextMode = TextMode.Hex
355
+
356
+ HexECI: TextMode = TextMode.HexECI
357
+
358
+ class ImageFormat(enum.Enum):
359
+ """Enumeration of image formats supported by read_barcodes"""
360
+
361
+ Lum = 16777216
362
+
363
+ LumA = 33554432
364
+
365
+ RGB = 50331906
366
+
367
+ BGR = 50462976
368
+
369
+ RGBA = 67109122
370
+
371
+ ARGB = 67174915
372
+
373
+ BGRA = 67240192
374
+
375
+ ABGR = 67305985
376
+
377
+ Lum: ImageFormat = ImageFormat.Lum
378
+
379
+ LumA: ImageFormat = ImageFormat.LumA
380
+
381
+ RGB: ImageFormat = ImageFormat.RGB
382
+
383
+ BGR: ImageFormat = ImageFormat.BGR
384
+
385
+ RGBA: ImageFormat = ImageFormat.RGBA
386
+
387
+ ARGB: ImageFormat = ImageFormat.ARGB
388
+
389
+ BGRA: ImageFormat = ImageFormat.BGRA
390
+
391
+ ABGR: ImageFormat = ImageFormat.ABGR
392
+
393
+ class Point:
394
+ """Represents the coordinates of a point in an image"""
395
+
396
+ @property
397
+ def x(self) -> int:
398
+ """
399
+ :return: horizontal coordinate of the point
400
+ :rtype: int
401
+ """
402
+
403
+ @property
404
+ def y(self) -> int:
405
+ """
406
+ :return: vertical coordinate of the point
407
+ :rtype: int
408
+ """
409
+
410
+ class Position:
411
+ """The position of a decoded symbol"""
412
+
413
+ @property
414
+ def top_left(self) -> Point:
415
+ """
416
+ :return: coordinate of the symbol's top-left corner
417
+ :rtype: zxingcpp.Point
418
+ """
419
+
420
+ @property
421
+ def top_right(self) -> Point:
422
+ """
423
+ :return: coordinate of the symbol's top-right corner
424
+ :rtype: zxingcpp.Point
425
+ """
426
+
427
+ @property
428
+ def bottom_left(self) -> Point:
429
+ """
430
+ :return: coordinate of the symbol's bottom-left corner
431
+ :rtype: zxingcpp.Point
432
+ """
433
+
434
+ @property
435
+ def bottom_right(self) -> Point:
436
+ """
437
+ :return: coordinate of the symbol's bottom-right corner
438
+ :rtype: zxingcpp.Point
439
+ """
440
+
441
+ def __str__(self) -> str: ...
442
+
443
+ class ErrorType(enum.Enum):
444
+ None = 0
445
+ """No error"""
446
+
447
+ Format = 1
448
+ """Data format error"""
449
+
450
+ Checksum = 2
451
+ """Checksum error"""
452
+
453
+ Unsupported = 3
454
+ """Unsupported content error"""
455
+
456
+ Format: ErrorType = ErrorType.Format
457
+
458
+ Checksum: ErrorType = ErrorType.Checksum
459
+
460
+ Unsupported: ErrorType = ErrorType.Unsupported
461
+
462
+ class Error:
463
+ """Barcode reading error"""
464
+
465
+ @property
466
+ def type(self) -> ErrorType:
467
+ """
468
+ :return: Error type
469
+ :rtype: zxingcpp.ErrorType
470
+ """
471
+
472
+ @property
473
+ def message(self) -> str:
474
+ """
475
+ :return: Error message
476
+ :rtype: str
477
+ """
478
+
479
+ def __str__(self) -> str: ...
480
+
481
+ class Barcode:
482
+ """The Barcode class"""
483
+
484
+ @property
485
+ def valid(self) -> bool:
486
+ """
487
+ :return: whether or not barcode is valid (i.e. a symbol was found and decoded)
488
+ :rtype: bool
489
+ """
490
+
491
+ @property
492
+ def text(self) -> str:
493
+ """
494
+ :return: text of the decoded symbol (see also TextMode parameter)
495
+ :rtype: str
496
+ """
497
+
498
+ @property
499
+ def bytes(self) -> bytes:
500
+ """
501
+ :return: uninterpreted bytes of the decoded symbol
502
+ :rtype: bytes
503
+ """
504
+
505
+ @property
506
+ def format(self) -> BarcodeFormat:
507
+ """
508
+ :return: decoded symbol format
509
+ :rtype: zxingcpp.BarcodeFormat
510
+ """
511
+
512
+ @property
513
+ def symbology(self) -> BarcodeFormat:
514
+ """
515
+ :return: decoded symbol symbology
516
+ :rtype: zxingcpp.BarcodeFormat
517
+ """
518
+
519
+ @property
520
+ def symbology_identifier(self) -> str:
521
+ """
522
+ :return: decoded symbology idendifier
523
+ :rtype: str
524
+ """
525
+
526
+ @property
527
+ def ec_level(self) -> str:
528
+ """
529
+ :return: error correction level of the symbol (empty string if not applicable)
530
+ :rtype: str
531
+ """
532
+
533
+ @property
534
+ def content_type(self) -> ContentType:
535
+ """
536
+ :return: content type of symbol
537
+ :rtype: zxingcpp.ContentType
538
+ """
539
+
540
+ @property
541
+ def position(self) -> Position:
542
+ """
543
+ :return: position of the decoded symbol
544
+ :rtype: zxingcpp.Position
545
+ """
546
+
547
+ @property
548
+ def orientation(self) -> int:
549
+ """
550
+ :return: orientation (in degree) of the decoded symbol
551
+ :rtype: int
552
+ """
553
+
554
+ @property
555
+ def error(self) -> Error | None:
556
+ """
557
+ :return: Error code or None
558
+ :rtype: zxingcpp.Error
559
+ """
560
+
561
+ @property
562
+ def extra(self) -> object:
563
+ """
564
+ :return: Symbology specific extra information as a Python dictionary (might be empty)
565
+ :rtype: dict
566
+ """
567
+
568
+ def to_image(self, scale: int = 1, add_hrt: bool = False, add_quiet_zones: bool = True) -> Image: ...
569
+
570
+ def to_svg(self, scale: int = 1, add_hrt: bool = False, add_quiet_zones: bool = True) -> str: ...
571
+
572
+ Result: TypeAlias = Barcode
573
+
574
+ def barcode_format_from_str(str: str) -> BarcodeFormat:
575
+ """
576
+ Convert string to BarcodeFormat
577
+
578
+ :type str: str
579
+ :param str: string representing barcode format
580
+ :return: corresponding barcode format
581
+ :rtype: zxingcpp.BarcodeFormat
582
+ """
583
+
584
+ def barcode_formats_from_str(str: str) -> BarcodeFormats:
585
+ """
586
+ Convert string to BarcodeFormats
587
+
588
+ :type str: str
589
+ :param str: string representing a list of barcodes formats
590
+ :return: corresponding barcode formats
591
+ :rtype: zxingcpp.BarcodeFormats
592
+ """
593
+
594
+ def barcode_formats_list(filter: BarcodeFormats = ...) -> BarcodeFormats:
595
+ """
596
+ Returns a list of available/supported barcode formats, optionally filtered by the provided format(s).
597
+
598
+ :type filter: zxingcpp.BarcodeFormats
599
+ :param filter: the BarcodeFormat(s) to filter by
600
+ :return: list of available/supported barcode formats (optionally filtered)
601
+ :rtype: list[zxingcpp.BarcodeFormat]
602
+ """
603
+
604
+ def read_barcode(image: object, formats: BarcodeFormats = ..., try_rotate: bool = True, try_downscale: bool = True, try_invert: bool = True, text_mode: TextMode = TextMode.HRI, binarizer: Binarizer = Binarizer.LocalAverage, is_pure: bool = False, ean_add_on_symbol: EanAddOnSymbol = EanAddOnSymbol.Ignore, return_errors: bool = False) -> Barcode | None:
605
+ """
606
+ Read (decode) a barcode from a numpy BGR or grayscale image array or from a PIL image.
607
+
608
+ :type image: buffer|numpy.ndarray|PIL.Image.Image
609
+ :param image: The image object to decode. The image can be either:
610
+ - a buffer with the correct shape, use .cast on memory view to convert
611
+ - a numpy array containing image either in grayscale (1 byte per pixel) or BGR mode (3 bytes per pixel)
612
+ - a PIL Image
613
+ - a QtGui.QImage
614
+ - a zxingcpp.ImageView object, which is effectively a memory view but with custom strides and ImageFormat
615
+ :type formats: zxing.BarcodeFormat|zxing.BarcodeFormats
616
+ :param formats: the format(s) to decode. If ``None``, decode all formats.
617
+ :type try_rotate: bool
618
+ :param try_rotate: if ``True`` (the default), decoder searches for barcodes in any direction;
619
+ if ``False``, it will not search for 90° / 270° rotated barcodes.
620
+ :type try_downscale: bool
621
+ :param try_downscale: if ``True`` (the default), decoder also scans downscaled versions of the input;
622
+ if ``False``, it will only search in the resolution provided.
623
+ :type try_invert: bool
624
+ :param try_invert: if ``True`` (the default), decoder also tries inverted (light on dark) barcodes.
625
+ :type text_mode: zxing.TextMode
626
+ :param text_mode: specifies the TextMode that governs how the raw bytes content is transcoded to text.
627
+ Defaults to :py:attr:`zxing.TextMode.HRI`.:type binarizer: zxing.Binarizer
628
+ :param binarizer: the binarizer used to convert image before decoding barcodes.
629
+ Defaults to :py:attr:`zxing.Binarizer.LocalAverage`.:type is_pure: bool
630
+ :param is_pure: Set to True if the input contains nothing but a perfectly aligned barcode (generated image).
631
+ Speeds up detection in that case. Default is False.:type ean_add_on_symbol: zxing.EanAddOnSymbol
632
+ :param ean_add_on_symbol: Specify whether to Ignore, Read or Require EAN-2/5 add-on symbols while scanning
633
+ EAN/UPC codes. Default is ``Ignore``.
634
+ :type return_errors: bool
635
+ :param return_errors: Set to True to return the barcodes with errors as well (e.g. checksum errors); see ``Barcode.error``.
636
+ Default is False.:rtype: zxingcpp.Barcode
637
+ :return: a Barcode if found, None otherwise
638
+ """
639
+
640
+ def read_barcodes(image: object, formats: BarcodeFormats = ..., try_rotate: bool = True, try_downscale: bool = True, try_invert: bool = True, text_mode: TextMode = TextMode.HRI, binarizer: Binarizer = Binarizer.LocalAverage, is_pure: bool = False, ean_add_on_symbol: EanAddOnSymbol = EanAddOnSymbol.Ignore, return_errors: bool = False) -> list[Barcode]:
641
+ """
642
+ Read (decode) multiple barcodes from a numpy BGR or grayscale image array or from a PIL image.
643
+
644
+ :type image: buffer|numpy.ndarray|PIL.Image.Image
645
+ :param image: The image object to decode. The image can be either:
646
+ - a buffer with the correct shape, use .cast on memoryview to convert
647
+ - a numpy array containing image either in grayscale (1 byte per pixel) or BGR mode (3 bytes per pixel)
648
+ - a PIL Image
649
+ - a QtGui.QImage
650
+ - a zxingcpp.ImageView object, which is effectively a memory view but with custom strides and ImageFormat
651
+ :type formats: zxing.BarcodeFormat|zxing.BarcodeFormats
652
+ :param formats: the format(s) to decode. If ``None``, decode all formats.
653
+ :type try_rotate: bool
654
+ :param try_rotate: if ``True`` (the default), decoder searches for barcodes in any direction;
655
+ if ``False``, it will not search for 90° / 270° rotated barcodes.
656
+ :type try_downscale: bool
657
+ :param try_downscale: if ``True`` (the default), decoder also scans downscaled versions of the input;
658
+ if ``False``, it will only search in the resolution provided.
659
+ :type try_invert: bool
660
+ :param try_invert: if ``True`` (the default), decoder also tries inverted (light on dark) barcodes.
661
+ :type text_mode: zxing.TextMode
662
+ :param text_mode: specifies the TextMode that governs how the raw bytes content is transcoded to text.
663
+ Defaults to :py:attr:`zxing.TextMode.HRI`.:type binarizer: zxing.Binarizer
664
+ :param binarizer: the binarizer used to convert image before decoding barcodes.
665
+ Defaults to :py:attr:`zxing.Binarizer.LocalAverage`.:type is_pure: bool
666
+ :param is_pure: Set to True if the input contains nothing but a perfectly aligned barcode (generated image).
667
+ Speeds up detection in that case. Default is False.:type ean_add_on_symbol: zxing.EanAddOnSymbol
668
+ :param ean_add_on_symbol: Specify whether to Ignore, Read or Require EAN-2/5 add-on symbols while scanning
669
+ EAN/UPC codes. Default is ``Ignore``.
670
+ :type return_errors: bool
671
+ :param return_errors: Set to True to return the barcodes with errors as well (e.g. checksum errors); see ``Barcode.error``.
672
+ Default is False.
673
+ :rtype: list[zxingcpp.Barcode]
674
+ :return: a list of Barcodes, the list is empty if none is found
675
+ """
676
+
677
+ class Image:
678
+ @property
679
+ def __array_interface__(self) -> dict: ...
680
+
681
+ @property
682
+ def shape(self) -> tuple: ...
683
+
684
+ def create_barcode(content: object, format: BarcodeFormat, ****kwargs) -> Barcode: ...
685
+
686
+ def write_barcode_to_image(barcode: Barcode, scale: int = 1, add_hrt: bool = False, add_quiet_zones: bool = True) -> Image: ...
687
+
688
+ def write_barcode_to_svg(barcode: Barcode, scale: int = 1, add_hrt: bool = False, add_quiet_zones: bool = True) -> str: ...
689
+
690
+ class ImageView:
691
+ def __init__(self, buffer: Annotated[NDArray, dict(writable=False)], width: int, height: int, format: ImageFormat, row_stride: int = 0, pix_stride: int = 0) -> None: ...
692
+
693
+ @property
694
+ def format(self) -> ImageFormat: ...
695
+
696
+ Bitmap: TypeAlias = Image
697
+
698
+ def write_barcode(format: BarcodeFormat, text: object, width: int = 0, height: int = 0, quiet_zone: int = -1, ec_level: int = -1) -> Image:
699
+ """
700
+ Write (encode) a text into a barcode and return 8-bit grayscale bitmap buffer
701
+
702
+ :type format: zxing.BarcodeFormat
703
+ :param format: format of the barcode to create
704
+ :type text: str|bytes
705
+ :param text: the text/content of the barcode. A str is encoded as utf8 text and bytes as binary data
706
+ :type width: int
707
+ :param width: width (in pixels) of the barcode to create. If undefined (or set to 0), barcode will be
708
+ created with the minimum possible width
709
+ :type height: int
710
+ :param height: height (in pixels) of the barcode to create. If undefined (or set to 0), barcode will be
711
+ created with the minimum possible height
712
+ :type quiet_zone: int
713
+ :param quiet_zone: minimum size (in pixels) of the quiet zone around barcode. If undefined (or set to -1),
714
+ the minimum quiet zone of respective barcode is used.:type ec_level: int
715
+ :param ec_level: error correction level of the barcode (Used for Aztec, PDF417, and QRCode only).
716
+ :rtype: zxingcpp.Bitmap
717
+ """