1
0
Fork
You've already forked python-barcode
0

Poor choice of default DPI and module width #39

Open
opened 2019年06月04日 11:45:58 +02:00 by Firefox2005 · 0 comments
Firefox2005 commented 2019年06月04日 11:45:58 +02:00 (Migrated from github.com)
Copy link

I am using the library for generating Code128 barcodes which will later be integrated in another image.

Without setting any writer options the default values for the ImageWriter are: DPI=300 and ModuleWidth=0.2 (labeled mm in the docs but that is not correct, as 0.2 results in 2mm).
These settings do not go well together, as with 300dpi one dot has the size of 0.8466mm - so the default module width would equal 2.36dots.

I did not have a look into the rounding but I can confirm, that some barcodes I generate can not be read with these settings. If I set the module width to a number that results in an integer number of dots (e.g. 0.8466mm or multiples thereof) I am able to scan these barcodes.

In general one could ask, why it uses mm as a unit at all and not pixels or at least offers the possibility to set the module width in pixels without using DPI.

I am using the library for generating Code128 barcodes which will later be integrated in another image. Without setting any writer options the default values for the ImageWriter are: DPI=300 and ModuleWidth=0.2 (labeled mm in the docs but that is not correct, as 0.2 results in 2mm). These settings do not go well together, as with 300dpi one dot has the size of 0.8466mm - so the default module width would equal 2.36dots. I did not have a look into the rounding but I can confirm, that some barcodes I generate can not be read with these settings. If I set the module width to a number that results in an integer number of dots (e.g. 0.8466mm or multiples thereof) I am able to scan these barcodes. In general one could ask, why it uses mm as a unit at all and not pixels or at least offers the possibility to set the module width in pixels without using DPI.
Sign in to join this conversation.
No Branch/Tag specified
main
pre-commit-ci-update-config
extensibility
fix_sizes
feature/longer_guard_bar
ean-without-checksum
readme-formatting
cleaning
cleanup
srolin/master
michieldwitte/left-alignment-fix
v0.13.1
v0.13.0
v0.12.0
v0.11.0
v0.10.0
v0.9.0
v0.8.3
v0.8.2
v0.8.1
v0.8.0
0.8beta1
0.7
0.7beta4
0.7beta3
0.7beta2
v0.6
v0.6b3
v0.6b2
v0.6b1
v0.5.0
v0.5.0b1
v0.4.3
v0.4.2
v0.4.1
v0.4
v0.4b2
v0.4b1
v0.3
v0.3b1
v0.2.1
v0.1
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
WhyNotHugo/python-barcode#39
Reference in a new issue
WhyNotHugo/python-barcode
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?