Hi,

You're registration to JIRA has been approved, please post your text there. I know nothing about that parameter so I asked ChatGPT which claims that the files will be smaller but encoding takes longer. What difference did you experience? I'm wonder if we should set true by default or not. The factory is a static so a setter would be for all calls, and an extra parameter would mean a call with 5 parameters.

Tilman

On 7/5/2025 11:39 AM, Zer Jun Eng wrote:
Dear PDFBox developers,

I'm writing to request an enhancement to the JPEGFactory class,
specifically concerning the createFromImage(PDDocument document,
BufferedImage image, float quality, int dpi) method.

Currently, when using this method, there isn't a direct way to enable the
setOptimizeHuffmanTables option of JPEGImageWriteParam. This optimization
can be quite beneficial for reducing file size.

To work around this, my team currently has to copy the JPEGFactory source
code into our project and modify the private encodeImageToJPEGStream
method. This approach isn't ideal as it makes maintenance more difficult
and prevents us from easily updating to new PDFBox versions.

Would you consider exposing this setOptimizeHuffmanTables option, perhaps
as an additional parameter to the createFromImage method or through a
separate setter on JPEGFactory? This would allow users to leverage this
optimization without resorting to workarounds.

Thank you for considering this request.

Thanks and regards,
Zer Jun Eng



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to