{System.TypeInitializationException: The type initializer for ‘Gdip’ threw an exception.
—> System.DllNotFoundException: libgdiplus
at System.Drawing.SafeNativeMethods.Gdip…cctor()
— End of inner exception stack trace —
at .(Object )
at .(Object )
at . ()
at .(Object , UInt32 )
at . (Boolean )
at .()
at .(Object[] , Type[] , Type[] , Object[] )
at .(Stream , String , Object[] , Type[] , Type[] , Object[] )
at .(Stream , String , Object[] )
at .(Stream , String , Object[] )
at .UpdateText(String , Point , Single , Color )
at Aspose.PSD.FileFormats.Psd.Layers.TextLayer.UpdateText(String text)
at Aspose.PSD.FileFormats.Psd.PsdImage.AddTextLayer(String text, Rectangle rect)
at TranslateLab.Common.PSDManager.Translate(Stream stream, TranslateManage TranslateLab, OCRManage OCRmaanage) in C:\Users\blackshining\Source\Repos\readermakers\translatelab-maui\TranslateLab\Common\PSDManager.cs:line 106
using (PsdImage image = new PsdImage(pnginfo.width, pnginfo.height))
{
var backup = new Layer(memory);
backup.Name = "backup";
image.AddLayer(backup);
pnginfo.stream.Position = 0;
memory = new MemoryStream();
pnginfo.stream.CopyTo(memory);
pnginfo.stream.Position = 0;
memory.Position = 0;
var back = new Layer(memory);
back.Name = "image";
image.AddLayer(back);
foreach (var x in OCRData)
{
var data = TranslateData.Where(es => es.OriginalText == x.Text).FirstOrDefault();
if (data == null)
continue;
var rect = new Rectangle(x.Area.Left, x.Area.Top, x.Area.Width, x.Area.Height);
if (x.Deg != 0)
back.Rotate(x.Deg);
back.Filter(rect, new MedianFilterOptions(Math.Max(rect.Height, rect.Width) / 2 + 1));
//back.Filter(rect, new MedianFilterOptions(30));
if (x.Deg != 0)
back.Rotate(x.Deg * -1);
var text = image.AddTextLayer(data.Text, rect);
var option = text.TextData.ProducePortion();
foreach(var font in text.TextData.Items)
{
font.Style.FontSize = 12;
font.Style.FillColor = Aspose.PSD.Color.FromArgb(x.TextColor.R, x.TextColor.G, x.TextColor.B);
}
if (x.Deg != 0)
text.Rotate(x.Deg);
}