Image scaling in word to Html conversions

Is there a way to keep the images in their original sizes when saving word documents in Html format?
Using the HtmlExportScaleImageToShapeSize property, seems to have no effect on the size of the generated images files. I would like to be able to turn of the image scaling. Can this be done?

Hi

Thanks for your inquiry. Could you please attach your document here for testing? I will check the problem on my side and provide you more information.

Best regards,

The document is attached. The image is scaled to 33%, and I would like to have the file in its full size.

Thanks.

Hi

Thank you for additional information. I managed to reproduce the problem with SaveOptions.HtmlExportScaleImageToShapeSize option. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
Best regards,

Hello!
Thank you for your patience.
This issue has been addressed. Please expect the fix in the next public build (release). I would also try to explain technical reason of such issues.
SaveOptions.HtmlExportScaleImageToShapeSize is not a strict option. When it is true (default value) all images are scaled to size of their shapes. But when it is false Aspose.Words doesn’t guarantee that all images will have original sizes. It’s just an instruction that Aspose.Words may leave images as they are represented in the model unless some other reasons arise. For instance, any image transform such as cropping or making grayscale imply rendering to the target scale. Some image might be shown in Microsoft Word as is, without any visual effects, but have some attributes that prevent Aspose.Words from saving as is. It’s better to say that internal algorithm prefers to scale if it is not “absolutely sure”.
If you really need to enforce saving images as they are, then you can traverse them all and convert their Shape.ImageData.ImageBytes to System.Drawing.Image by calling ToImage. Further you can save them to disk. This workaround works only with images, not other shapes such as autoshapes.
Regards,

What will the fix include? Will there be a new “strict” option to force original images?

I used your workaround and it worked quite well. The img html tags will include width and height attributes that still use the scaled sizes, so I have to adjust or remove them. Also I have to make sure that the filenames matches the ones in the html files. This works but an option to use the images as they are, would be even nicer

Thanks.

Hello!
Thank you for your feedback. There won’t be a “strict” option. What would you expect from hypothetical strict option when processing cropped images? It wouldn’t be nice to output them as they are. The fix will exclude some shape attributes from consideration in rendering criteria.
Now I see what goal you’d like to achieve. Width and height attributes of element should match the original image size, not the size of the shape. Of course Aspose.Words behaves differently: size is taken from shape objects. You can work-around this by adjusting shape size to image size. To determine real image parameters you also can use System.Drawing.Image class. In this case you don’t need to worry about file names.
Note that if you insert images with DocumentBuilder class then they have 100% size by default.
Regards,

The issues you have found earlier (filed as 12524) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.