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

Add a QR code resolution parameter #13

Open
Permanently opened this issue Sep 25, 2021 · 14 comments · Fixed by #14
Open

Add a QR code resolution parameter #13

Permanently opened this issue Sep 25, 2021 · 14 comments · Fixed by #14

Comments

@Permanently
Copy link

Describe the solution you'd like
A resolution parameter to choose how big the QR code is (e.g. Google Chart's chs)

Additional context
Just add some simple parameter such as res=<width>x<height> or something. I dunno ¯_(ツ)_/¯

@sayanarijit
Copy link
Owner

Hi, as documented, you can use http headers X-QR-Min-Width and X-QR-Min-Height.
Let me know if that's what you're looking for.

@Permanently
Copy link
Author

That's not what I was referring to. What I meant was something that would actually resize the QR code to the specified resolution. For example on Google Chart, whether it's a small or large amount of content on the QR code, it can be resized down to 128x128 as requested.

@sayanarijit
Copy link
Owner

Ah got it... Should be easy to implement.

sayanarijit added a commit that referenced this issue Sep 25, 2021
sayanarijit added a commit that referenced this issue Sep 25, 2021
@sayanarijit
Copy link
Owner

Not perfect, but I think #14 is the best we can do within the library's capabilities.

sayanarijit added a commit that referenced this issue Sep 25, 2021
@sayanarijit
Copy link
Owner

But of course, there's always room for further improvements. Pls create a PR if you find something out.

@sayanarijit
Copy link
Owner

Or maybe I'll can rethink a better way. So keeping the issue open.

@sayanarijit sayanarijit reopened this Sep 25, 2021
@gdkali
Copy link

gdkali commented Sep 28, 2021

Hi, as documented, you can use http headers X-QR-Min-Width and X-QR-Min-Height.
Let me know if that's what you're looking for.

I have type "curl qrcode.show -d @imp_details -H "X-QR-Max-Width:128, X-QR-Max-Height:128"" and it's not working.

@sayanarijit
Copy link
Owner

I have type "curl qrcode.show -d @imp_details -H "X-QR-Max-Width:128, X-QR-Max-Height:128"" and it's not working.

@gdkali try -H "X-QR-Max-Width: 128" -H "X-QR-Max-Height: 128"

@gdkali
Copy link

gdkali commented Sep 28, 2021

I have type "curl qrcode.show -d @imp_details -H "X-QR-Max-Width:128, X-QR-Max-Height:128"" and it's not working.

@gdkali try -H "X-QR-Max-Width: 128" -H "X-QR-Max-Height: 128"

It worked, but the output is not what I need.
The size is way too bigger.
I tried to reduce the size(28*28) but no impact.

I have content on the text file are as follow
Content name:-
Type of file:-
Link of Url:-
Access type:-

image

@sayanarijit
Copy link
Owner

@gdkali try smaller sizes -H "X-QR-Max-Width: 40" -H "X-QR-Max-Height: 40".
Default size for terminal is 20, for other image formats it's 360.

@gdkali
Copy link

gdkali commented Sep 28, 2021

@gdkali try smaller sizes -H "X-QR-Max-Width: 40" -H "X-QR-Max-Height: 40". Default size for terminal is 20, for other image formats it's 360.

I have noticed If you add multiple numbers of lines, the size of the QR code gets increase which is not normal behavior I believe for example

After adding 15 lines
image

Before adding 15 lines
image

@gdkali
Copy link

gdkali commented Sep 28, 2021

@gdkali try smaller sizes -H "X-QR-Max-Width: 40" -H "X-QR-Max-Height: 40". Default size for terminal is 20, for other image formats it's 360.

I have noticed If you add multiple numbers of lines, the size of the QR code gets increase which is not normal behavior I believe for example

After adding 15 lines image

Before adding 15 lines image

QR code default size should not increase similar to web platform

@sayanarijit
Copy link
Owner

@gdkali the qr code size increases only on the terminal to compensate for the increased number of blocks, because on terminals, the size of each block is fixed. You should get expected size when downloading other image formats using the Accept header.

@gdkali
Copy link

gdkali commented Sep 28, 2021

@gdkali the qr code size increases only on the terminal to compensate for the increased number of blocks, because on terminals, the size of each block is fixed. You should get expected size when downloading other image formats using the Accept header.

Uh, that's the reason qr code size gets bigger.
I try to add multiple headers still size ratio is same

$ curl qrcode.show -d @imp_details -H "X-QR-Max-Width: 128" -H "X-QR-Max-Height :128" -H "Accept: image/png" --output abc.png

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

Successfully merging a pull request may close this issue.

3 participants