@@ -51,21 +51,34 @@ use QrCodeSuite\QrRender\Color\RgbColor;
5151use QrCodeSuite\QrRender\Color\CmykColor;
5252
5353// Render the encoded QR code block data as RGB PNG
54+ // Width and height should measure about 800 pixels
5455$renderer = new QrRender\QrCodeRendererPng();
5556$renderer
57+ ->setApproximateSize(800)
5658 ->setForegroundColor(new RgbColor(255, 0, 255))
5759 ->setBackgroundColor(new RgbColor(51, 51, 51))
5860 ->render($qrCodeData, 'path/to/qr-code.png');
5961
62+ // Get the effective width and height of the rendered image
63+ $imageWidth = $renderer->getWidth();
64+ $imageHeight = $renderer->getHeight();
65+
6066// Render the encoded QR code block data as CMYK TIFF
67+ // Width and height should measure about 800 pixels
6168$renderer = new QrRender\QrCodeRendererTiff();
6269$renderer
70+ ->setApproximateSize(800)
6371 ->setForegroundColor(new CmykColor(0, 100, 0, 0))
6472 ->setBackgroundColor(new CmykColor(0, 100, 100, 0))
6573 ->render($qrCodeData, 'path/to/qr-code.tif');
6674
75+ // Get the effective width and height of the rendered image
76+ $imageWidth = $renderer->getWidth();
77+ $imageHeight = $renderer->getHeight();
78+
6779// Render the encoded QR code block data as CMYK vectorized EPS
6880// EPS has no background color. It is just the blocks on blank cnavas.
81+ // EPS also has no approximate size. Scale the vectorized image as you like.
6982$renderer = new QrRender\QrCodeRendererEps();
7083$renderer
7184 ->setForegroundColor(new CmykColor(0, 100, 0, 0))
@@ -79,14 +92,6 @@ $renderer
7992Contributing to our projects is always very appreciated.
8093** But: please follow the contribution guidelines written down in the ` CONTRIBUTING.md ` document.**
8194
82- ## TODOs
83-
84- - ~~ Decorate the code base with some unit tests.~~
85- - Allow configuration of the QR codes like:
86- - ~~ Foreground color~~
87- - ~~ Background color~~
88- - Image size of PNG and TIFF
89-
9095## License
9196
9297QR Code Suite is under the MIT license.
0 commit comments