sayanarijit / qrcode.show

[WORKING PROTOTYPE] Generate QR code easily for free - QR Code Generation as a Service
https://QRcode.show
GNU Affero General Public License v3.0
596 stars 32 forks source link

Add a QR code resolution parameter #13

Open Permanently opened 2 years ago

Permanently commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

sayanarijit commented 2 years ago

Not perfect, but I think https://github.com/sayanarijit/qrcode.show/pull/14 is the best we can do within the library's capabilities.

sayanarijit commented 2 years ago

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

sayanarijit commented 2 years ago

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

gdkali commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

@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