Psd maui text layer error

{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);

            }

@blackshining we haven’t test Aspose.PSD with maui yet. Please check this article: How to run Aspose.PSD in docker
Under the Linux you need to install the following packages (This is from docker file):

RUN apt-get update
RUN yes | apt-get install -y apt-transport-https
RUN yes | apt-get install -y libgdiplus
RUN yes | apt-get install -y libc6-dev

I see that you run code under the Windows, so, it’s possible you need to install Mono framework.

…that’s ios, android. apt is not…

@blackshining do you want to use the standalone copy of Aspose.PSD library on each mobile device? I think the good solution is to make some web-service and make requests to it. Otherwise you need to provide license file with the each copy of your app.

We created 2 investigation tasks:
PSDNET-1550: Check the ability to use Aspose.PSD for .Net under the iOs
PSDNET-1551: Check the ability to use Aspose.PSD for .Net under the Android

The only way to make Aspose.PSD run on the iOs and Android is to provide the libgdiplus with the your app. But, we haven’t tested this scenario.

my app has webservice is bad idea… i don’t image save webservice and traffic… that’s dangerus

@blackshining I’ll text you back soon. We are working on the investigation of quick way to fix this issue. Other teams faced with the similar issue with MAUI.

@blackshining
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-1550,PSDNET-1551

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.