Open masternan opened 6 months ago
I modified ImageSharpImageConverter.ConvertImage like this,it is ok.
` public ImageResult ConvertImage(byte[] imageData)
{
using MemoryStream memoryStream = new MemoryStream();
using Image
num3++;
if (num3 == 8 || j == whiteBackgroundImage.Width - 1)
{
memoryStream.WriteByte((byte)num2);
num2 = 0;
num3 = 0;
}
}
}
return new ImageResult
{
RawData = memoryStream.ToArray(),
BinaryByteCount = binaryByteCount,
BytesPerRow = num
};
}`
Unable to reproduce.
^XA
^FO32,128^GFA,2688,2688,28,:Z64:eNrtwTEBAAAAwqD+qWcLL6AAAOBnXV92Fw==:84a9
^FT245,180^A0N,50,50^FH\^FD#PartName#^FS
^XZ
hotprocess.txt Attach is the file exported from zebra designer,and i used DrawerOptions in the following code to analyze it. Then i transfer it to konva object in order to edit it in web form with Konva.js. At last I transfer the konva object to zpl, something goes wrong such as i describled.
private static DrawerOptions BuildDrawOption(string fontName = "NotoSansSC-SemiBold") { var fontFile = Path.Combine(AppContext.BaseDirectory, "fonts", $"{fontName}.ttf"); var drawOptions = new DrawerOptions { FontLoader = fontName => { return SKTypeface.FromFile(fontFile); }, OpaqueBackground=false, PdfOutput=false, RenderFormat = SKEncodedImageFormat.Png, RenderQuality = 100, Antialias=true, ReplaceDashWithEnDash = false }; return drawOptions; }
The "hotprocess.txt" file contains two labels; I suspect you may only be exporting the first, which is blank and contains only directives.
The second label in the file renders correctly, according to what is show in Zebra Designer:
Thank you,but the case you described is not the reason. When I modified ImageSharpImageConverter.ConvertImage function to add a whiteBackground to image label before analyzing it ,and it returns ok.
Attach is the exception before i modified the function, please refer it,thanks.
Please ensure that you are using SixLabors.ImageSharp v2.1.8 throughout your project. I suspect you may have a dependency conflict.
I use SixLabors.ImageSharp3.1.4 ,but when i modified the ImageSharpImageConverter.ConvertImage function,it returns ok. so i think the problem was caused by the transparent png data. Attatch is the right result after i modified the function.
Reopening this. Upgrading to ImageSharp 3.1.4 breaks rendering of GraphicField elements, and some barcodes. The project should be updated for forwards compatibility.
png hexdata call ImageSharpImageConverter.ConvertImage retun empty data. and copy zpl code to https://labelary.com/, it display transparent image zone for png data.