We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to reset or compress image?

Hi, Support,

Is there any function to reset or compress image? it seems the Shape.ImageData function provide nothing to reset or compress an image in document? How to do it?

Thanks for your help!


The easy way is to remove the old Shape node (image), and then insert new image at the same position in DOM hierarchy by using the DocumentBuilder.InsertImage method.

If that is not acceptable, then please provide complete details of your usecase. We will investigate the scenario on our end and provide you more information.

Thanks for your reply.
It is not best way to remove the old image and then insert a new one at the same position by DocumentBuilder.InsertImage method. Therefore, the best way is to add the feature to the future updating version. For example: Shape.ImageData.Compress(ImageCompressOptions).
As for the ImageCompressOptions, it may be like this:
ImageCompressOptions.CompressQualityValue=0-100, 100 means minimal compress with large filesize and high image quality.

This compression may be used at this case:
for example, 100 pictures with size(5000x2000) and filesize(~6Mb) have been inserted into a document and the final document may be about 60M. therefore, its filesize is too large to transfer to another by network. With this aim, all the pictures inserted need to automatically compress to make the document filesize down so that the final filesize of the compressed document may be down to about 20M or even less.


We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-18139. We will further look into the details of this requirement and will keep you updated on the status of the linked issue.