Comments (9)
@gabzim
look like you can pass width
and height
in options
if you set the type to be png to any function that makes a png file.
toDataURL toFile toFileStream
this should totally be documented. sorry friend.
https://github.com/soldair/node-qrcode/blob/master/lib/renderer/png.js#L10
from node-qrcode.
Every qr code version requires a specific number of points on a grid.
To make qr codes always one size you must force the version to a specific
value and set the size in pixels of the point.
The version you pick will govern the maximum amount of data you can store.
On Jul 17, 2011 2:27 PM, "tixelated" <
[email protected]>
wrote:
Hi - would love to help make QR code image sizes configurable at run time,
any pointers?Reply to this email directly or view it on GitHub:
#4
from node-qrcode.
Right. Another way to deal with it is to come from the other direction - have the size setting be tied to the point size, rather than the overall image. Developers could then do some quick experimenting (or math) to determine the best fit for their app. So - not really "200px x 200px" but rather "Version 2 @ 8px per point" (= 200px x 200px, and the developer can dial down the point size or version if they want to make it smaller.)
I guess I should ask - are point sizes configurable right now? If so then it's all set, I didn't see that -
from node-qrcode.
I think they are. In the object its a property called module or something
ambiguous :).
When I get home I will look.
On Jul 17, 2011 5:10 PM, "tixelated" <
[email protected]>
wrote:
Right. Another way to deal with it is to come from the other direction -
have the size setting be tied to the point size, rather than the overall
image. Developers could then do some quick experimenting (or math) to
determine the best fit for their app. So - not really "200px x 200px" but
rather "Version 2 @ 8px per point" (= 200px x 200px, and the developer can
dial down the point size or version if they want to make it smaller.)I guess I should ask - are point sizes configurable right now? If so then
it's all set, I didn't see that -Reply to this email directly or view it on GitHub:
#4 (comment)
from node-qrcode.
right now based on my interface its not possible without going deeper than my inital export.
if i expose a config value that lets you hardset the QRCode level you would generate codes of predictable size.
QRCode.QRCodeDraw.scale = 10;// this value has a bad name but its the size in pixels of the black square
QRCode.QRCodeDraw.QRErrorCorrectLevel = 1;// least error correction. these do not sort numerically
//---------- not real. proposed interface
QRCode.QRCodeDraw.QRLevel = 11;// a level
//----------
QRCode.QRCodeDraw.draw(new Canvas(200,200),text,function(error,canvas){
cb(error,canvas)
});
i could find in the version capacity table here
https://github.com/soldair/node-qrcode/blob/master/lib/qrcapacitytable.js
that my max characters would be 321
each black square would be 10 px because i configured the scale variable
from node-qrcode.
That would be pretty useful - "auto" by default, or hard set by the developer. In all of our use cases, we know the text size ahead of time and can truncate accordingly if necessary to get some predictability. I would imagine this is pretty common...
from node-qrcode.
I think this has been solved in latest releases 👍
from node-qrcode.
I need to generate qr codes of 512x512, how was this solved? there's no info on this, btw, I'm on node.js, not HTML/canvas.
from node-qrcode.
@soldair thanks for the info and speed! much appreciated!
from node-qrcode.
Related Issues (20)
- 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
- Please check out i have updated the README.md
- 1.5.3 版本出现的 HOT 1
- Occasionally generate invalid QR Code
- 生成出的二维码链接,为什么多出了dstrCdOc、dstrOpId、dstrUnId这三个参数?
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.