Thread overview
Just another QR code library
18 hours ago
Ferhat Kurtulmuş
16 hours ago
Salih Dincer
16 hours ago
Salih Dincer
12 hours ago
Andrea Fontana
11 hours ago
Salih Dincer
11 hours ago
Andrea Fontana
5 hours ago
Andrea Fontana
1 day ago

Hey everyone,

I've been working on a small project lately and thought I'd share it with you all. It's a simple QR code generation library. It is based on Project Nayuki's library.

The main idea behind it was to create something that doesn't rely on any external dependencies. I know how annoying it can be when you want to do something simple like generating a QR code, and you end up having to install a bunch of packages. So, this library is completely self-contained.

Some key points about it:

  • No external dependencies, as mentioned.
  • You can tweak various generation parameters to get the QR code just how you want it.
  • It supports exporting to different formats: SVG, PNG, and PPM.

If you need something straightforward, this might be useful.

dub add qr

import qr;
import std.stdio;

void main()
{
   // ASCII art FTW
   QrCode("Hello D!").writeln();

   // Save as PNG. Look, Ma, no external deps!
   QrCode("Hello D!").save("simple-qr.png");
}

The code and docs are up on GitHub https://github.com/trikko/qr

Feel free to check it out, use it if you find it helpful, and let me know if you run into any issues or have suggestions for improvements.
Cheers!

Andrea Fontana

18 hours ago

On Wednesday, 16 October 2024 at 12:58:29 UTC, Andrea Fontana wrote:

>

Hey everyone,

I've been working on a small project lately and thought I'd share it with you all. It's a simple QR code generation library. It is based on Project Nayuki's library.

[...]

After watching the recent video of Veritasium, I was planning to write one. Yours seems great. It is al so a good example when you write things half in C and half in D with importC.

https://www.youtube.com/watch?v=w5ebcowAJD8

16 hours ago

On Wednesday, 16 October 2024 at 12:58:29 UTC, Andrea Fontana wrote:

>
import qr;
import std.stdio;

void main()
{
   // ASCII art FTW
   QrCode("Hello D!").writeln();

   // Save as PNG. Look, Ma, no external deps!
   QrCode("Hello D!").save("simple-qr.png");
}

Feel free to check it out, use it if you find it helpful, and let me know if you run into any issues or have suggestions for improvements.
Cheers!

I haven't tried it yet, but it's an excellent example of high-quality work, especially with the use of D's standard library and importC. Please accept my congratulations on your contribution. I have a small question:

Is it possible to increase or decrease the image file resolution?

SDB@79

16 hours ago
On Thursday, 17 October 2024 at 10:33:08 UTC, Salih Dincer wrote:
> I haven't tried it yet...

Now i noticed save(), this is one of the range functions; i think it's forwardrange. Hence the name which might cause confusion.

SDB@79


12 hours ago
On Thursday, 17 October 2024 at 10:40:33 UTC, Salih Dincer wrote:
> On Thursday, 17 October 2024 at 10:33:08 UTC, Salih Dincer wrote:
>> I haven't tried it yet...
>
> Now i noticed save(), this is one of the range functions; i think it's forwardrange. Hence the name which might cause confusion.
>
> SDB@79

I was undecided whether to call the method 'save' or 'write', but 'write' usually has a different structure, and in this case, I'm actually saving a file.
11 hours ago
On Thursday, 17 October 2024 at 14:39:42 UTC, Andrea Fontana wrote:
>
> I was undecided whether to call the method 'save' or 'write', but 'write' usually has a different structure, and in this case, I'm actually saving a file.

My suggestion would be export, convert or better saveAs()...

SDB@79
11 hours ago
On Thursday, 17 October 2024 at 16:07:57 UTC, Salih Dincer wrote:
> On Thursday, 17 October 2024 at 14:39:42 UTC, Andrea Fontana wrote:
>>
>> I was undecided whether to call the method 'save' or 'write', but 'write' usually has a different structure, and in this case, I'm actually saving a file.
>
> My suggestion would be export, convert or better saveAs()...
>
> SDB@79

I'm considering saveAs for the next version, then!

Andrea
9 hours ago

On Wednesday, 16 October 2024 at 12:58:29 UTC, Andrea Fontana wrote:

>

Hey everyone,
...

  • It supports exporting to different formats: SVG, PNG, and PPM.
    ...
    Andrea Fontana

Wow .. the png code is beautiful!

Kind regards,
Christian

5 hours ago

On Thursday, 17 October 2024 at 17:40:30 UTC, Christian Köstlin wrote:

>

On Wednesday, 16 October 2024 at 12:58:29 UTC, Andrea Fontana wrote:

>

Hey everyone,
...

  • It supports exporting to different formats: SVG, PNG, and PPM.
    ...
    Andrea Fontana

Wow .. the png code is beautiful!

Kind regards,
Christian

Minimal!

Andrea