Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QR code size #19

Open
andreas5232 opened this issue Feb 15, 2018 · 4 comments
Open

QR code size #19

andreas5232 opened this issue Feb 15, 2018 · 4 comments

Comments

@andreas5232
Copy link

QR codes containing longer text are printed with a smaller size than those containing only a short text. Maybe there is also a possibility to reduce the margins, so that there is more space for the QR code.

dev-zero added a commit to dev-zero/dymoprint that referenced this issue Sep 27, 2018
this should help with issue computerlyrik#19 but is not a final solution
@dev-zero
Copy link
Contributor

I've added a parameter which should help with that by reducing the amount of whitespace around the QRCode. Although as I see it, the problem is the rather poor resolution of the device: the QR Code is always scaled by a an integer: this is usually just 2 for a QRCode (so, one dot on the matrix results in 2 dots on the label). If the QRCode gets bigger than half the size it suddenly shrinks to 1 dot in the matrix being 1 pixel.

@computerlyrik
Copy link
Owner

I totally agree @dev-zero - with 64 dots there is no much option for scaling.
I do not know if the printer-engine can be somehow re-written to get a higher (virtual) resolution.

computerlyrik pushed a commit that referenced this issue Mar 28, 2019
this should help with issue #19 but is not a final solution
computerlyrik pushed a commit that referenced this issue Mar 28, 2019
this should help with issue #19 but is not a final solution
computerlyrik pushed a commit that referenced this issue Mar 29, 2019
this should help with issue #19 but is not a final solution
@hyppoCom
Copy link

The QRCode size is larger than the actual size, the QRCode library adds a white frame around the QR.
I changed the code as follows to detect how many "blank lines" are added and removes that lines (before and after the QR) and the same number of zeros before and after the "good lines".

        code = QRCode(labeltext[0],error='M')
        qr_text = code.text().split()
        # CHANGE_STARTS_HERE
        # Counts and removes trailing empty (0,0,...) lines
        allzz=0;
        for i in range(0,len(qr_text)-1):
            if qr_text[0][0:8]=='00000000':
                qr_text.pop(0)
                qr_text.pop(len(qr_text)-1)
                allzz=allzz+1
            else:
                break
        for i,line in enumerate(qr_text):
            qr_text[i]=line[allzz:-allzz]
        # CHANGE_ENDS_HERE
        # create an empty label image
        labelheight = lm._MAX_BYTES_PER_LINE * 8
        labelwidth = labelheight

@maresb
Copy link
Collaborator

maresb commented May 17, 2021

Hi @hyppoCom, this functionality looks really useful. This computerlyrik fork seems to be inactive, but I'd welcome a PR on my fork here: https://github.com/maresb/dymoprint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants