python-barcode icon indicating copy to clipboard operation
python-barcode copied to clipboard

Barcode lines are not equal

Open sidraaaaa opened this issue 4 years ago • 3 comments

import barcode from barcode.writer import ImageWriter code=input("Enter Code") EAN = barcode.get_barcode_class('ean8') ean = EAN(code, writer=ImageWriter()) imag = ean.save('barcode')

Sometimes these unequal lines appears in my image. Why is that so? They are not that visible though, but it seems quite odd when they appear multiple times. The same thing happens when I try to print code 128 and code 39.

My output:

Expected Output:

sidraaaaa avatar Jul 18 '20 16:07 sidraaaaa

Get Same issue.

Code : 00000

itf = ITF(u'00000', writer=ImageWriter())

itf
<ITF('000000')>

itf.build()
['11001100110011001111100000111110000011001100110011111000001111100000110011001100111110000011111000001100111110011']

fullname = itf.save('itf_barcode')

Image: itf_barcode

We can see in the 3 last bar, that the tiny bar have not the good width.

But if i use the SVGWriter instead of the ImageWriter, the bar have the correct width.

Nilad avatar May 10 '21 15:05 Nilad

You probably want guardbars: EAN(code, writer=ImageWriter(), guardbars=True)

WhyNotHugo avatar May 10 '21 15:05 WhyNotHugo

@WhyNotHugo Probably yes, but the guardbars option is not available in itf.py

Nilad avatar May 10 '21 15:05 Nilad