Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plan to beautify the qrcode? #1

Open
ouzhou opened this issue Aug 19, 2018 · 4 comments
Open

Any plan to beautify the qrcode? #1

ouzhou opened this issue Aug 19, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@ouzhou
Copy link

ouzhou commented Aug 19, 2018

Nice job! I think it is the most cool js-qrcode lib in github!

I see the foreground & background parameter in renderer, and i want to find a way to add some logo in the center of the qrcode and change the style of the fill pattern, can you give me some suggestions?

Thanks 👍

@ouzhou
Copy link
Author

ouzhou commented Aug 19, 2018

some examples:

image
image
image

@obany
Copy link
Member

obany commented Aug 20, 2018

Those are some cool looking QR codes!

There is no support for this kind of styling at present, I can think of a few ways you could possibly achieve this at the moment.

  • Use the raw on/off array produced from the QR.generate method and then render the data yourself with your additions
  • Use the output from the svg renderer and then modify the content
  • Use the output from the canvas and modify that

I will mark this as a future enhancement, but it may be some time before it gets implemented.

@obany obany added the enhancement New feature or request label Aug 20, 2018
@ouzhou
Copy link
Author

ouzhou commented Aug 27, 2018

If i want create many QR , should i use new IotaQR.QR() every time?
I know js have gc ability , but i dont know it whether cause memory leak
Here are my code

const IotaQR = require("@tangle-frost/iota-qr-lib");
function async createQR(qrid) {
  // 0 autodetect
  // 1:7% 0:15% 3:25% 2:30%
  const qr = new IotaQR.QR(0, 0);
  qr.addText(qrid);
  const qrCellData = qr.generate();
  const cellSize = 10;
  const marginSize = 40;
  const jpegRenderer = IotaQR.QRRendererFactory.instance().create("jpg");
  const imgDOM = await jpegRenderer.renderHtml(qrCellData, cellSize, marginSize);
  return imgDOM.src;
}

for(let i=0; i<10000; i++) {
  createQR(i) ;
}

@obany
Copy link
Member

obany commented Aug 27, 2018

I did some memory performance testing using your code and it all looks as though everything is garbage collected correctly.

image

You can see that after each peak there is a drop as the gc happens and the memory usage falls to below the initial baseline before the qr codes are created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants