# Set image resolution This topic describes how to set image resolution in PDF file using the GroupDocs.Viewer Java API. If the output PDF file contains images, you can reduce its resolution. To allow changing the image resolution, set the [setCompressImages()](https://reference.groupdocs.com/viewer/java/com.groupdocs.viewer.options/pdfoptimizationoptions/#setCompressImages-boolean-) and [setResizeImages()](https://reference.groupdocs.com/viewer/java/com.groupdocs.viewer.options/pdfoptimizationoptions/#setResizeImages-boolean-) setters to `true` in the [PdfOptimizationOptions](https://reference.groupdocs.com/viewer/java/com.groupdocs.viewer.options/pdfoptimizationoptions). The GroupDocs.Viewer compresses all images in the file. The [setMaxResolution()](https://reference.groupdocs.com/viewer/java/com.groupdocs.viewer.options/pdfoptimizationoptions/#setMaxResolution-int-) property determines the maximum resolution. The following code snippet shows how to reduce image resolution in the file: {{< tabs "Example1">}} {{< tab "Java" >}} ```java try (Viewer viewer = new Viewer("sample.docx")) { PdfViewOptions viewOptions = new PdfViewOptions(); PdfOptimizationOptions optimizationOptions = new PdfOptimizationOptions(); optimizationOptions.setCompressImages(true); optimizationOptions.setImageQuality(50); optimizationOptions.setResizeImages(true); optimizationOptions.setMaxResolution(100); viewOptions.setPdfOptimizationOptions(optimizationOptions); viewer.view(viewOptions); } ``` {{}} {{}} The following image demonstrates the result: ![Set max resolution](https://docs.groupdocs.com/viewer/java/images/pdf-rendering/optimization/optimization-pdf-set-max-resolution.png)