Hello Aspose Team
We use Aspose.Words 23.6.0 on our .NET Framework 4.8 Project.
Following Code throws ArgumentException on Step 5:
// Step 1) Create Word document
Document document = new Document();
// Step 2) Load an image from File
Image image = Image.FromFile(Path.Combine(Directory.GetCurrentDirectory(), "LogoIncident.jpeg"));
// Step 3) Following line executes normally.
int imageWidth1 = image.Width;
// Step 4) Load image data into shape
Shape shape = new Shape(document, ShapeType.Image);
shape.ImageData.SetImage(image);
// Step 5) Following line throws ArgumentException, because it is called after "shape.ImageData.SetImage(image)"
int imageWidth2 = image.Width;
This seems to happen only in some kind of image data. We could not found what kind of images are triggering this problem.
Attached you will find an example solution with latest version of Aspose(23.10.0) to reproduce this issue.
Thank you for your help and kind regards
Baki
AsposeImageProblem.zip (537.2 KB)