Comments (5)
Hi @gajus, at the moment there's no way to specify a width, but you could generate an higher resolution image using a bigger scale value. Then you could downscale the image to the desidered width if needed.
Other possible solution:
Since the qrcode is made of white and black pixels I think you can upscale the image without losing quality just by disabling pixel interpolation.
from node-qrcode.
Hi @gajus, at the moment there's no way to specify a width, but you could generate an higher resolution image using a bigger scale value. Then you could downscale the image to the desidered width if needed.
This is what I've ended up doing.
Other possible solution:
Since the qrcode is made of white and black pixels I think you can upscale the image without losing quality just by disabling pixel interpolation.
Will give this a shot.
from node-qrcode.
@vigreco should we consider adding support for this resize call? may be a common enough ask for those who cant use svg or dont want to impment their own renderer on top of the bit array
from node-qrcode.
@soldair yes, of course! We could add a maxSize
option (which will mutually exclude scale
) to specify the image dimensions in px.
Output images could be smaller than maxSize
when (px/modules) is not an integer.
What do you think?
from node-qrcode.
@gajus, a width option is now available in [email protected]
.
Thanks!
from node-qrcode.
Related Issues (20)
- 1.5.3 still breaks by not shipping qrcode/build/qrcode.js to npm HOT 8
- Synk check failing for yargs v15.4.1
- Since version 1.5.2,`build` folder is missing in the NPM package HOT 1
- Redraw of QR code seems not to work out-of-the-box
- window.print() renders QR code svg as black square in print preview. firefox only HOT 1
- Support for `title` tag for SVG accessibility
- Use from within modules in the browser HOT 1
- Using it through module.js file in node.js
- Intermittent truncated response
- Text wrapping,文本换行
- QRCode.toDataUrl returns nothing
- Installation failure HOT 1
- install from npm does not build browser version HOT 7
- How make qr code larger? HOT 1
- 'Unexpected token' error - brackets needed in url
- "You need to specify a canvas element" error when using Cloudflare Workers with `qrcode` HOT 5
- callback function delays to execute HOT 1
- Extract the core into its own module
- install breaks with node v20.5.1 HOT 4
- No assets on CDNJS for versions 1.5.2 and 1.5.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-qrcode.