Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
JMM
Experienced
Topic Author
Posts: 216
Joined: 02 Aug 2021, 11:18

AVIF support

02 Jun 2026, 19:23

Hello, Karl,

Is there anything that I can change/modify on my X3 sites that will allow them to display AVIF files?  Or would it take much more than that & require a rewrite of the code on your end?

I did a search here in the forums, but the only mention of AVIF was almost 3 years ago.

Thanks in advance.

Regards,
John
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14469
Joined: 30 Sep 2006, 03:37

Re: AVIF support

02 Jun 2026, 22:13

Hi John. May I ask for what specific reason(s) you are asking about AVIF support? Do you intend to convert all your images to AVIF? Or is it just that you have a couple of images already in AVIF format?

AVIF really only offers benefits if you are squeezing the maximum out of your images, typically used by high-volume websites, and for smaller images, where every single byte counts. Basically when every millisecond counts in getting the info out to the user. Also, do you then plan to exclude all users with browsers that don't support AVIF? Even if you would want to "fallback" to JPG, it means you would then need duplicate copies of AVIF and JPG and all their thumbnail variations. AVIF is also slower than JPG for decompressing images in the browser, it's not only beneficial.

Almost all websites services that provide AVIF use an image-encoding service on the backend, that serves the image format automatically depending on 1. the users browser support, 2. the nature of the image. This is tremendously useful of course, as it's done automatically while the website only needs to upload images in whatever original format they like. Services like Cloudflare and Cloudinary do this, although they will charge a fee depending on request volume. Also, you would need PHP 8.2 or higher to process AVIF, although that's normally not a problem. Also, PHP doesn't support meta data from AVIF images (IPTC and EXIF), and can't save directly to the images either.

It really isn't productive to implement directly into a self-hosted app like X3 unfortunately.

My Files Gallery app does support AVIF, but only because "it can", and it would only work if the browser supports it and the server (PHP) supports it. It won't dynamically serve another format to browsers that don't support avif, and I would never force "avif only" photo galleries.
https://demo.files.gallery/?samples/ima ... ilter=avif

On a related note, below is a WebP (similar to avif) vs JPG quality file size quality comparison from the Optimizing Images for Photo Websites article I wrote.
Image
 
User avatar
JMM
Experienced
Topic Author
Posts: 216
Joined: 02 Aug 2021, 11:18

Re: AVIF support

Yesterday, 18:40

Apologies, I thought that I had replied to you last month.

No particular reason for wanting to possibly use AVIF files.  I came 1 or more websites who's pictures downloaded in AVIF format, so I searched the Internet for information about that format, compression-wise, and also whether it supports EXIF.

The AVIF format would've been used on my private X3 sites (no public access), which still temporarily consists of many hundreds of GB of PNG files, of which I still need to cleanup/edit and then save as JPG.  I just figured that if AVIF was a possibility with X3, that I could just go from PNG straight to AVIF, bypassing JPG.  That's all... no other reason.

Thanks for your explanation.

Regards,
John
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14469
Joined: 30 Sep 2006, 03:37

Re: AVIF support

Today, 10:14

JMM wrote:PNG files, of which I still need to cleanup/edit and then save as JPG.
It's not clear why you need to save your existing PNG images as JPG. Normally, PNG format is used for certain types of images, like graphics and logos, but not for photos. There is a PNG 24-bit "lossless" format that could be used for photos, but normally you would instead use JPG low compression (high quality), as it's much more efficient.

If indeed your PNG images are mostly photos, then yes it would be better to convert to JPG. And in this case, yes it could offer slightly better compression (smaller size per same quality) if you used AVIF instead. However, it renders slower, is less compatible, and really doesn't offer much benefit for you or your visitors. Besides, X3 simply doesn't support AVIF, because of browser support and PHP support (you would need X3 to create both JPG and AVIF for full compatibility, although in 2026 most servers and browsers support AVIF).

Personally, I still use PNG and JPG with proper compression, as they still offer the best compression and compatibility combo.

Have a nice day! :upside_down: