z38/metzli

How to change the size?

Closed this issue · 3 comments

I would like to use your library, aztec library. But as you know, in code you didn't add comments, I don't know how to modificate your library for my changes. I need change size, default for my message I receive img 41x41. Which params should I change to generate other size? For example 23x23?
Second question - Code Error Correction - could you send me information where I can change this?
Thank you for answer
Greg

z38 commented

I'd like to apologize for the missing documentation. At the moment, I'm quite busy and it might take a while until I'm able to work on it.

Meanwhile, to change the error correction percentage just provide $eccPercent to Metzli\Encoder\Encoder::encode($content, $eccPercent) (per default it uses 33%).

Currently, the code size is automatically optimized such that as few layers as possible are used. Therefore, a minimum size can not be provided at the moment. If you like to extend the library, I would be happy to merge the changes! The current layer calculation can be found in Encoder.php#L60-92. I think it should be possible to just pad the data with some zeroes until you desired number of layers (e.g. 23x23 would be 3 compact layers and 41x41 would be 7 layers) is reached.

Just let me know if I can explain or help you somewhere!

In Encoder.php#L128 the calculation is shown.

Thank you for answer and thank you for this library :)
I was trying change $eccPercent, but the aztec code looks the same(for 5 or 10 or 40 as value) . My main problem is that I send the string to the library, but after generating png, using smartphone, I receive other string. I mean the first letters are the same, but later something is wrong. Could you give me some advise what I should change to receive the correct string? Or maybe it is correct?
Regarding to the code size, I was trying change this part in your code which you said, but frankly speaking, I'm not able to change this code, because I often have error:
Undefined offset: -3
I changed it with success - I mean without error, but png code looked not correct - I mean white space on the png aztec code, I guess it's not correct. Could you send me any rules for these calculation(you said about layers, but something more)? Or could you explain me the calculation?

Edit:
Ok, you're right, $eccPercent works - my application on my smartphone didn't read correct, but I changed this app - and now it's ok, I mean, I can change error correction using this parameter.

I'm not sure this is what was needed here, but I made a little adjustment so I could increase the size of the output image. I made use of the scale factor $f that already was in the code.

I also sent a pull request (#4) in case other people are looking for this functionality. Hope it helps.