Free Support Forum - aspose.com

Image.Load ImageLoadException: Cannot open an image. The image file format may be not supported at the moment

Try to add Image to specific layer. But get
ImageLoadException: The image file format may be not supported at the moment.

    static void Main(string[] args)
    {
        Aspose.PSD.License license = new Aspose.PSD.License();
        license.SetLicense(@"Aspose.PSD.lic");        
        var dir = @"path_to_photo\";
        // load an existing PSD image as Image
        using (PsdImage image = (PsdImage)PsdImage.Load(dir + "img_action.psd"))
        {
          
            Layer layer = image.Layers.FirstOrDefault(x => x.Name == "Put a photo here");              
            var target = (RasterImage)Image.Load(dir + "img_green.jpg");//exception here
            layer.DrawImage(new Point(0, 0), target);
            image.Save(dir + "result.jpg", true);
        }
    }

@VRMikeARVI,

I have observed the issue shared by you and request you to please try using latest Aspose.PSD for .NET 20.3. In case there is still an issue then please share the source file reproducing the issue on your end.

For 20.3 the same exception.
I shared full source code in first post
I was trying with jpg and png files but have the same issue.

@VRMikeARVI,

Can you please share the source file reproducing the issue with us.

img_green.jpg (3.7 MB)

@VRMikeARVI,

Please also share the source PSD used in your sample code too.

PSD is doesn’t matter because we have error when trying to load RasterImager from file

@VRMikeARVI,

I have observed the issue shared and a ticket with ID PSDNET-624 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.