DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.76k stars 389 forks source link

Support for av1-avif #546

Closed Phreak87 closed 3 years ago

Phreak87 commented 3 years ago

Hey,

Is it possible to implement the brandnew avif Image Format? This would ne great.

Thx

DanBloomberg commented 3 years ago

It's not going to happen any time soon. leptonica is a library for images, not video, and each additional format supported comes with a significant cost in complexity and development effort.

If av1 comes out with a format for single images that has advantages over png, jpeg, tiff and webp, and furthermore gets significant traction (e.g.., supported by all major browsers), this decision can be revisited.

amitdo commented 3 years ago

Dan,

AV1 is a video format, AVIF is an image format.

Just to let you know the current support status by major browsers:

https://caniuse.com/avif

https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)

No pressure from me to support it in Leptonica.

DanBloomberg commented 3 years ago

Thank you. It's early days, and leptonica only supports static images (plus a very weak support for animated webp).

Dan

stweil commented 3 years ago

See also https://github.com/tesseract-ocr/tesseract/issues/2930 where another new image format (HEIC) is suggested.

amitdo commented 3 years ago

I'll just mention yet another interesting new image format - JPEG XL. Google is involved in creating this format.

https://cloudinary.com/blog/how_jpeg_xl_compares_to_other_image_codecs

https://github.com/google/brunsli

https://research.google/pubs/pub48554/

https://jpeg.org/jpegxl/

https://gitlab.com/wg1/jpeg-xl

Phreak87 commented 3 years ago

my main interest on this topic is the much higher compression rate compared to webp. i use leptonica in a webserver which compresses the images to webp to speed up the page loading. higer compression would be awesome! animation on this images is in this case not relevant to me.

If this happens i like to provide also a new leptonica c# wrapper interface on my GH-Page. i hope this topic will be revisited if the format becomes traction.

DanBloomberg commented 3 years ago

@amitdo

Thank you for bringing jpeg-xl into the discussion. It has come along faster than I realized. From the comparison paper, it is likely to be standardized in a year or so. It has a clean migration path from jpeg, much better quality at the same bit rate, and fast encoding/decoding. It's also being developed by some very smart people, and unlike the other compression formats mentioned above, it has no known patent issues.

amitdo commented 1 year ago

An update about jpeg-xl:

https://www.phoronix.com/news/Chrome-Dropping-JPEG-XL-Reasons

DanBloomberg commented 1 year ago

What a difference 2 years makes! From the hot new thing -- the perfect upgrade from jpeg -- to a not-to-be-supported test bed for experimenting on codecs. Good thing I waited :-)

Google has, IMHO, been surprisingly poor in following up on new image compression initiatives. WebP is a very nicely implemented Google codec for still images, derived from a video format. The wavelet encoding results in much fewer visible artifacts from edges than with the DCT compression of jpeg. And Google also implemented an animated version, so I included a shim in leptonica to generate an animated WebP from a pixa. And yet ... Google's gmail, the second most widely used mail program in the world, doesn't support animated WebP; if you put one in, it just shows you the first image. https://www.caniemail.com/features/image-webp/ Note that as of 2020, both Apple and Microsoft fully support WebP, including animation. Google could also have used a version of the original video codec for animated WebP. Either would have provided a good alternative within gmail to gif: in speed, compression rate and image quality. But they punted!