Dpi Util
object DpiUtil
Stateless utility for reading and writing DPI (dots per inch) metadata in image files.
Supports PNG (pHYs chunk) and JPEG (app0JFIF segment) metadata formats. Falls back to a default of 300 DPI when metadata is missing or unreadable.
Functions
Link copied to clipboard
Reads DPI metadata from an image file.
Reads DPI metadata from image bytes.
Link copied to clipboard
fun writeImageWithDPI(image: BufferedImage, outputFile: File, dpi: Int = DEFAULT_DPI, logSignature: String = DEFAULT_LOG_SIGNATURE)
Writes a BufferedImage to a PNG file with proper DPI metadata. This ensures Tesseract gets the correct resolution information.