CommentShape set image data to fill not update scale size

There we use in old version (23.6.0) and cannot update now.

var comment = sheet.Comments[sheet.Comments.Add(0, 0)];
var imgData = File.ReadAllBytes(@"testPic.png");
comment.CommentShape.Fill.ImageData = imgData;
//now the RelativeToOriginalPictureSize is true, WidthScale and HeightScale are 100
//belows setter not change anything and do nothing at all.
comment.CommentShape.RelativeToOriginalPictureSize = true;
comment.CommentShape.WidthScale = 100;
comment.CommentShape.HeightScale = 100;
workbook.Save("testFile.xlsx",SaveFormat.Xlsx);

But in saved file, comment size not uses picture orignal size.

I need a workaround to process it.

@Flithor
Please use the following sample code to achieve the goal.

Workbook wb = new Workbook();
Worksheet sheet = wb.Worksheets[0];
var comment = sheet.Comments[sheet.Comments.Add(0, 0)];
var imgData = File.ReadAllBytes(filePath + @"testPic.png");            
comment.CommentShape.Fill.ImageData = imgData;
//now the RelativeToOriginalPictureSize is true, WidthScale and HeightScale are 100
//belows setter not change anything and do nothing at all.
comment.CommentShape.RelativeToOriginalPictureSize = true;
comment.CommentShape.WidthScale = 100;
comment.CommentShape.HeightScale = 100;

// set width and height
MemoryStream stream = new MemoryStream(imgData);
Image img = Image.FromStream(stream);
comment.CommentShape.Width = img.Width;
comment.CommentShape.Height = img.Height;
//end

wb.Save(filePath + "testFile.xlsx", SaveFormat.Xlsx);

Hope helps a bit.

So. Can only read the image size in other way?

Is there any way without using additional other libraries?

@Flithor
If you don’t consider updating the version, there is currently no better way. If you are considering updating the version, we will enhance the functionality and establish a new ticket to track this issue.

We may not update.
But fix it will be fine.

@Flithor
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): CELLSNET-54285

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.

@Flithor,

We are pleased to inform you that your issue (logged earlier as “CELLSNET-54285”) has been resolved. The fix will be included in our upcoming release version (Aspose.Cells v23.10) scheduled for release in first half of October 2023. We will let you know when the next release is published.

The issues you have found earlier (filed as CELLSNET-54285) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi