Git Product home page Git Product logo

Comments (5)

vigreco avatar vigreco commented on August 25, 2024 1

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.

gajus avatar gajus commented on August 25, 2024

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.

soldair avatar soldair commented on August 25, 2024

@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.

vigreco avatar vigreco commented on August 25, 2024

@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.

vigreco avatar vigreco commented on August 25, 2024

@gajus, a width option is now available in [email protected].
Thanks!

from node-qrcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.