diff --git a/shard.yml b/shard.yml index 3b28185..7a8346b 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: qr-code -version: 1.0.2 +version: 1.0.3 crystal: ">= 0.36.1" development_dependencies: diff --git a/src/qr-code/export/png.cr b/src/qr-code/export/png.cr index 0fa3790..2e4c435 100644 --- a/src/qr-code/export/png.cr +++ b/src/qr-code/export/png.cr @@ -2,7 +2,7 @@ require "stumpy_png" # https://github.com/whomwah/rqrcode/blob/master/lib/rqrcode/export/png.rb#L1 class QRCode - def as_png( + def as_canvas( bit_depth : Int32 = 1, border_modules : Int32 = 3, color_type : Symbol = :grayscale, @@ -33,6 +33,26 @@ class QRCode end end + png + end + + def as_png( + bit_depth : Int32 = 1, + border_modules : Int32 = 3, + color_type : Symbol = :grayscale, + color : String = "#000000", + fill : String = "#ffffff", + size : Int32 = 128 + ) + png = as_canvas( + bit_depth, + border_modules, + color_type, + color, + fill, + size + ) + # return the image bytes io = IO::Memory.new StumpyPNG.write(png, io)