This project has moved. For the latest updates, please go here.

Barcodes and transparency

Jul 21, 2016 at 7:49 AM
Hi, im trying to render a barcode to a System.Drawing.Bitmap (well actually a GraphicsMill bitmap but i can get that from a System.Drawing.Bitmap) that supports transparency.

The existing renderer doesnt support transparency. It looks like my options are to modify that renderer to support transparency or there seems to be a PixelDataRenderer which supports transparency however that doesnt appear to be in the nuget package.

Is there a plan on releasing this or what do you recommend as the best approach going forward?
I'd prefer to stay on using nuget and am not sure of the legal implications if i copy the existing code into my application and alter it to support transparency.

Thanks
Coordinator
Jul 27, 2016 at 6:37 PM
The following should work (I actually didn't try it):
var writer = new BarcodeWriterPixelData { Format = BarcodeFormat.QR_CODE };
writer.Renderer.Background = Color.FromArgb(0x00FFFFFF);
var pixeldata = writer.Write("<content here>");
Another one with Bitmap:
var writer = new BarcodeWriter { Format = BarcodeFormat.QR_CODE };
var bitmap = writer.Write("<content here>");
bitmap.MakeTransparent(writer.Renderer.Background);