Closed codaamok closed 2 years ago
Apparently that's an automatic behavior of the library used to render QR codes, which rounds the "block sizes" (whatever that is 😅) in order to ensure a sharp and readable QR code.
https://github.com/endroid/qr-code/issues/278
I have just checked, and this is more likely to happen with smaller image sizes than with bigger image sizes.
I have also tried the option suggested in that ticket, and it indeed removes this behavior, but I guess it comes at the cost of having less readable QR codes.
I'll probably add a config option to Shlink, to allow optionally disabling this rounding, and document what's the reason and the risk on doing it.
Hey, I appreciate the super-fast response!
This feature is now implemented and will be part of Shlink 2.10.0
From that version on, it will be possible to disable this behavior globally via config options or environment variables, or on a per-request basis sending roundBlockSize=false
in the query params.
How Shlink is set-up
Summary
I'm noticing that not all QR codes respect the margin
0
configured either via query parameter or in my server's config (the new default config option in 2.9.0).Current behavior
Many QR code images (consistently) have wrong margins, see image below.
When I say "consistently", I mean if I regenerate the QR codes, the same shortcodes always look the same.
Not sure if it's relevant, all of the below are from other domains that my Shlink is configured to use (not the default domain). I only have two shortcuts used on the default domain, and the QR codes for those two shortcodes do not experience this issue.
Expected behavior
I expect to see zero margin around the QR image: right up to the borders of the image file with no whitespace.
How to reproduce
Set server default margin for QR code to 0 and/or pass
margin=0
in your URI.Here are some example URLs on my Shlink instance, some are more exaggerated than others. e.g. most offending is https://cookadam.co.uk/get-cmunusedsources/qr-code?size=200&margin=0.
https://www.cookadam.co.uk/memcm-wsus-woes-wsusctrl-log-cannot-open-database-susdb-requested-by-the-login-the-login-failed-login-failed-for-user-domainserver/qr-code?size=200&margin=0 https://www.cookadam.co.uk/sccm-sql-server-upgrade-from-2012-sp4-to-2017-cu13/qr-code?size=200&margin=0 https://www.cookadam.co.uk/sccm-database-move-failed-to-create-backup-sql-ssb-certificate/qr-code?size=200&margin=0 https://www.cookadam.co.uk/installedon-property-blank-get-hotfix-and-get-wmiobject-class-win32_quickfixengineering/qr-code?size=200&margin=0 https://www.cookadam.co.uk/linux-compare-dd-wrts-wan-ip-to-a-hosts-wan-ip/qr-code?size=200&margin=0 https://www.cookadam.co.uk/updatesdeployment-log-job-error-0x80004005/qr-code?size=200&margin=0 https://www.cookadam.co.uk/sccm-management-point-500-19-ccmmessaging-log-0x87d00231/qr-code?size=200&margin=0 https://www.cookadam.co.uk/get-cmunusedsources/qr-code?size=200&margin=0 https://www.cookadam.co.uk/creating-dynamic-azure-arm-templates/qr-code?size=200&margin=0 https://www.cookadam.co.uk/starting-to-automate-animated-content-for-virtual-events/qr-code?size=200&margin=0 https://www.cookadam.co.uk/sccm-hardware-inventory-troubleshooting/qr-code?size=200&margin=0 https://www.cookadam.co.uk/throttling-distribution-point-bandwidth/qr-code?size=200&margin=0 https://www.cookadam.co.uk/upgrading-to-php-7-2-on-ubuntu/qr-code?size=200&margin=0 https://cookadam.co.uk/memcm-wsus-woes-wsusctrl-log-cannot-open-database-susdb-requested-by-the-login-the-login-failed-login-failed-for-user-domainserver/qr-code?size=200&margin=0 https://cookadam.co.uk/sccm-sql-server-upgrade-from-2012-sp4-to-2017-cu13/qr-code?size=200&margin=0 https://cookadam.co.uk/sccm-database-move-failed-to-create-backup-sql-ssb-certificate/qr-code?size=200&margin=0 https://cookadam.co.uk/installedon-property-blank-get-hotfix-and-get-wmiobject-class-win32_quickfixengineering/qr-code?size=200&margin=0 https://cookadam.co.uk/linux-compare-dd-wrts-wan-ip-to-a-hosts-wan-ip/qr-code?size=200&margin=0 https://cookadam.co.uk/updatesdeployment-log-job-error-0x80004005/qr-code?size=200&margin=0 https://cookadam.co.uk/sccm-management-point-500-19-ccmmessaging-log-0x87d00231/qr-code?size=200&margin=0 https://cookadam.co.uk/get-cmunusedsources/qr-code?size=200&margin=0 https://cookadam.co.uk/creating-dynamic-azure-arm-templates/qr-code?size=200&margin=0 https://cookadam.co.uk/starting-to-automate-animated-content-for-virtual-events/qr-code?size=200&margin=0 https://cookadam.co.uk/sccm-hardware-inventory-troubleshooting/qr-code?size=200&margin=0 https://cookadam.co.uk/throttling-distribution-point-bandwidth/qr-code?size=200&margin=0 https://cookadam.co.uk/upgrading-to-php-7-2-on-ubuntu/qr-code?size=200&margin=0 https://cookadam.co.uk/profile/qr-code?size=200&margin=0 https://www.cookadam.co.uk/profile/qr-code?size=200&margin=0