Convert Word DOCX to Images using Java | Set JPEG Quality & Resolution

public static void main(String[] args) throws Exception {
        String inputFileName = Paths.get("979943-BLU-625.docx").toString();
        Document document = new Document(inputFileName);
        final ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
        options.setImageBrightness(0.7f);
        options.setImageContrast(0.7f);
        final List<FileTargetDTO> list = new ArrayList<>(document.getPageCount());
        log.info("document size:"+document.getPageCount());
        for (int i = 0; i < document.getPageCount(); i++) {
            options.setPageSet(new PageSet(i));
            final String filename = "aaa";
            
            document.save(filename,options);
        }
    }

https://tezign-assets.oss-cn-beijing.aliyuncs.com/b82091828ba6f1a7e6011606dc468b77.docximage.zip (1.3 MB)

@zyx,

You can convert Word DOCX to Images and then increase the quality of JPEG images by using the following options:

Document doc = new Document("C:\\Temp\\b82091828ba6f1a7e6011606dc468b77.docx");

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
options.setImageBrightness(0.7f);
options.setImageContrast(0.7f);
options.setJpegQuality(100);
options.setUseAntiAliasing(true);
options.setUseHighQualityRendering(true);
options.setResolution(300);

for (int i = 0; i < doc.getPageCount(); i++) {
    options.setPageSet(new PageSet(i));
    String filename = "C:\\Temp\\231328\\2\\page " + i + ".jpg";

    doc.save(filename, options);
}