When using the save file option after generating a data matrix code, the saved image file is large with tons of whitespace around the data matrix code image. The dimensions of the image file is 9600x5760 pixels, which is quite large.
Am I missing some settings to eliminate white space around data matrix code itself and/or to minimize the size of generated image to just fit the rendered size of the data matrix code?
I really want to be able to generate an image that is 1 inch by 1 inch with no whitespace around it so the image can be injected into a label form, etc. as-is without having to resize the image or get rid of whitespace around the image.
Sample code:
BarcodeSettings bs = new BarcodeSettings();
bs.Type = BarCodeType.DataMatrix;
bs.ShowText = false;
bs.Unit = GraphicsUnit.Inch;
bs.BarHeight = 1;
bs.AutoResize = false;
bs.Data2D = "Just some text to include.";
BarCodeGenerator bg = new BarCodeGenerator(bs);
string filename = "TestFile.png";
bg.GenerateImage().Save(filename);
System.Diagnostics.Process.Start(filename);