Skip to content

v0.1.1

Latest

Choose a tag to compare

@derangga derangga released this 31 Mar 03:12
a2a74bf

What's New

Cache Result Support

CompressionResult now supports caching the compressed image to disk via
cacheResult(). Once cached, the in-memory byte array is released to reduce memory
pressure.

  • CompressionResult.cacheResult() — writes bytes to a file and releases the in-memory
    ByteArray
  • CompressionResult.cachedPath — returns the file path of the cached result, or
    null if not cached
  • CompressionResult.isBytesAvailable — indicates whether in-memory bytes are still
    held
  • Accessing .bytes after caching throws IllegalStateException with the cached file
    path for guidance

Compress from File Path

Komig.compress() now accepts a filePath: String directly.

val result = Komig.compress("/path/to/image.jpg") {
    quality(80)
    format(OutputFormat.WEBP)
}

New Exception Type

  • KomigException.FileIOException — thrown when a file cannot be read at the given
    path