Running JPEG-XL tools on shared Dreamhost

July 20th, 2023. Tagged: hosting, images, tools

Let's see how to setup and run cjxl (and its sibling djxl) on a simple shared hosting provider so you can encode and decode JPEG-XL (aka JXL) images.

How

There are better ways to install libjxl and its command-line tools but they require you to have sufficient privileges on your computer or server. With inexpensive shared host such as Dreamhost (buy hosting with my affiliate link) you're limitted in what you can do. Worry not, it's still possible!

1. Get a precompiled binary from JXL releases page. What you want is the linux-static build such as jxl-linux-x86_64-static-v0.8.1.tar.gz (at the time of writing, it's the latest available)
JXL binaries

2. Download and uncompress
JXL directory

3. Copy the cjxl (and optionally djxl for decompressing jxl files) and copy (e.g. FTP) them to you home directory in a /jxl directory maybe, like /home/username/jxl

4. ssh and change permissions so these files are executable

chmod +x cjxl
chmod +x djxl

(Or don't ssh and use your FTP program to make the files executable)

5. Done!

To test go to any directory with an image and try for example:

$ ~/jxl/cjxl guitar-pedals.jpg guitar-pedals.jxl

Lo! Hello, 21st century!

How do you know the JXL is not corrupt in any way? Well...

Test in Firefox nightly

1. Download Firefox nightly from here
2. Go to about:preferences#experimental
3. Check the box "Media: JPEG XL"
JXL checkbox in Firefox Nightly
4. Load the image e.g. https://www.phpied.com/files/blogimages/guitar-pedals.jxl

Ok, WHY?!

  • Why JXL? It's the future!
  • Why now? iOS 17 is around the corner. Suddenly the browser support will be much larger, including desktop Safari and iOS Safari and non-Safari browsers on iOS.
  • Why me? Chrome folks need a little nudge. They want to see adoption before they re-add support to Chrome (this is a speculation, based on their reasons to remove it in first place). So we, the Web developers, need to demonstrate interest.
  • Why shared host? Shared hosting still powers large population of sites out there (another speculation, based on personal experience). It's affordable and there are no surprise bills. People use it. I use for this here site and all my sites actually.

Next?

I think I'll try my luck with a WordPress plugin that helps with the adoption. Stay tuned.

Tell your friends about this post on Facebook and Twitter

Sorry, comments disabled and hidden due to excessive spam.

Meanwhile, hit me up on twitter @stoyanstefanov