sylikc / jpegview

Fork of JPEGView by David Kleiner - fast and highly configurable viewer/editor for JPEG, BMP, PNG, WEBP, TGA, GIF and TIFF images with a minimal GUI. Basic on-the-fly image processing is provided - allowing adjusting typical parameters as sharpness, color balance, rotation, perspective, contrast and local under-/overexposure.
Other
2.22k stars 128 forks source link

Implement AVIF transformations #305

Closed qbnu closed 5 months ago

qbnu commented 6 months ago

HEIF files can contain clap, irot and imir boxes which indicate cropping, rotation and mirroring transformations respectively. libheif takes care of this for us, but libavif doesn't. Fortunately we can just use existing helper functions to do the transformations.

Test files:
https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles/Link-U * https://git.zpl.fi/exif-orientation/tree/images (RotXMirY.avif files)
https://github.com/chromium/chromium/tree/main/third_party/blink/web_tests/images/resources/avif (cropped images)

* Note that the cropped AVIFs here fail to decode with libavif due to the crop's non-integer Y offset. They then fall back to libheif, so they can't be used for testing this change. Chromium disables libavif's strict clap validation and just ignores the clap if it has non-zero offsets, so it displays the images uncropped but with the correct rotation and mirroring. Not sure if we should just copy their logic. See https://github.com/chromium/chromium/commit/3a13337543c1e7de6914f87cd6f02ab06751c572

sylikc commented 5 months ago

wow this is pretty cool, cropping, mirroring, and rotating...