Free Support Forum - aspose.com

DPI of Images in Office Documents

Hi Aspose Team,

I'm working on conversions to PDF and facing some space issues. The office documents (doc, docx, xls, xlxs, ppt, pptx.. etc.) that I get contain Images. These Images have a big file size for their display size, like they have been inserted directly from the digital camera...

I would like to set the image quality, for example to 300 DPI. Is there a convenient way to do this? Otherwise which ways do I have to do something like this? I saw you offer Apose.Imaging as new Java component, is it able to support something like that?

The worst scenario would be to extract the image to the file system, convert it to 300 DPI, remove the "big" image from the document and insert the 300 DPI image. I'm afraid this would be very complex, fragile and could lead to layout issues..

I hope you can help.

Thank you in advance!

Kind regards
Peter

Hi Peter,


Thanks for your inquiry. I am representative of Aspose.Words team. I would suggest you please try using the ‘CompressImages’ project available in Aspose.Words for Java Samples below. I hope, this will help in achieving what you’re looking for.
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/entry187175.aspx

Please let me know if I can be of any further assistance.

Best Regards,

Hello Awais,

thank you for your quick and helpful response for Words. The CompressionImages sample is very nice! :)

I will have a look into Cells and Slides if I find something similar there.

Kind regards
Peter

Hi Peter,


I am representing Aspose.Slides. I regret to share that presently there is no option available in Aspose.Slides for .NET/Java to compress the added images. Aspose.Slides adds the image as it is. If your concern is large image and you like to reduce the image frame size then you may follow this documentation link for your kind reference. You can set any frame size for the image no matter how big it is.

However, If the intentions are to reduce the image size added in your presentation which seems evident from your inquiry; in this case I regret to share that Aspose.Slides adds the image as it is in presentation slides and you need to manage the image before adding that to slides as mentioned in last paragraph of your post.

Many Thanks,

Hi,


I am a representative of Aspose.Cells team. I am afraid, currently there is no option available in Aspose.Cells for .NET/Java to compress the added images in the spreadsheets/Excel files although you may change the image format type (e.g Png, Gif, etc.) that is going to be rendered in the generated PDF file. See a sample code here for your reference:

//…
PdfSaveOptions pso = new PdfSaveOptions(SaveFormat.PDF);
//Use this option if you need to convert the whole sheet per page only
pso.setOnePagePerSheet(true);
pso.setImageType(ImageFormat.getPng());
wb.save(“e:\test2\OriginalTestFile.pdf”, pso);

Aspose.Cells adds the image as it is. If your concern is large image and you like to reduce the image frame size then you may follow this document for your kind reference. You may get the Picture object and set its height / width accordingly.


Also, you may try to extract images from the worksheets and you need to manage the image before re-adding that to the cells/sheet as you pointed out in your original post. See the document for your reference (Note: the code is written for .NET version but you may modify it for JAVA version accordingly as there is not much difference b/w .NET and JAVA version of the product now.):
http://www.aspose.com/docs/display/cellsnet/Extract+Images+from+Worksheets


Thank you.