5 votes

Help needed with jpegli please

Hi
Seems we need to compile jpegli from git.

https://github.com/google/jpegli

I'm not able to do this at present.
Maybe a tildean person here is. :-)

I want to experiment and compare results with my installed mozjpeg.

Anybody know where there is a jpegli precompiled?
Something to drop into Linux usr/local/bin.
Or a windows executable to use with wine.

Blogpost... https://opensource.googleblog.com/2024/04/introducing-jpegli-new-jpeg-coding-library.html

20 comments

  1. [15]
    Wes
    (edited )
    Link
    Sure. I compiled these with gcc. It includes two binaries: cjpegli (encoder) and djpegli (decoder). Download zip via Dropbox. Link will probably expire eventually, when I clean up my files.

    Sure. I compiled these with gcc. It includes two binaries: cjpegli (encoder) and djpegli (decoder).

    Download zip via Dropbox. Link will probably expire eventually, when I clean up my files.

    4 votes
    1. [14]
      Fishtail_Parka
      Link Parent
      Hi Wes Thanks, but it's asking for a shared libjpegli library that I don't have. :-( Message says... cjpegli: error while loading shared libraries: libjpegli_threads.so.0.12: cannot open shared...

      Hi Wes
      Thanks, but it's asking for a shared libjpegli library that I don't have.
      :-(
      Message says...
      cjpegli: error while loading shared libraries:
      libjpegli_threads.so.0.12:
      cannot open shared object file: No such file or directory

      1. [13]
        Wes
        (edited )
        Link Parent
        Ah, missing library. I'll have to see if I can include that in the build as well. Hang tight.

        Ah, missing library. I'll have to see if I can include that in the build as well. Hang tight.

        2 votes
        1. [12]
          Fishtail_Parka
          Link Parent
          A "static" build, I think.

          A "static" build, I think.

          1. [11]
            Wes
            Link Parent
            Okay, I've repackaged it and updated the link above. Give it another try.

            Okay, I've repackaged it and updated the link above. Give it another try.

            1 vote
            1. [10]
              Fishtail_Parka
              (edited )
              Link Parent
              No, it's not static enough. cjpegli: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory

              No, it's not static enough.
              cjpegli: error while loading shared libraries:
              libjpeg.so.62:
              cannot open shared object file: No such file or directory

              1. [9]
                Wes
                Link Parent
                The customer demands even more static. Alright, I've basically bundled every dependency that your Linux system might not have. Link is updated again. If this doesn't work, I claim ignorance of...

                The customer demands even more static. Alright, I've basically bundled every dependency that your Linux system might not have. Link is updated again.

                If this doesn't work, I claim ignorance of using cmake as a pitiful web dev.

                4 votes
                1. [8]
                  Fishtail_Parka
                  Link Parent
                  Hi It's still trying to link to stuff... cjpegli: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by cjpegli) Thanks for trying anyway. :-)

                  Hi
                  It's still trying to link to stuff...
                  cjpegli: /usr/lib/x86_64-linux-gnu/libstdc++.so.6:
                  version `GLIBCXX_3.4.29' not found (required by cjpegli)

                  Thanks for trying anyway.
                  :-)

                  1. [7]
                    Wes
                    Link Parent
                    It may honestly be easier to build yourself, as it'll use your systems libraries. In this case, I think my C++ runtime was too new for your system. Nonetheless, one more for the road? Link is...

                    It may honestly be easier to build yourself, as it'll use your systems libraries. In this case, I think my C++ runtime was too new for your system.

                    Nonetheless, one more for the road? Link is updated...

                    Gosh, I don't envy C devs.

                    3 votes
                    1. [6]
                      Fishtail_Parka
                      Link Parent
                      No It's trying to link to libc.so.6 and libm.so.6 now. Maybe static builds is too complex for Linux. So let it go. Thanks again. I can't find any cjpegli.exe or djpegli.exe in google search....

                      No
                      It's trying to link to libc.so.6 and libm.so.6 now.
                      Maybe static builds is too complex for Linux.
                      So let it go.
                      Thanks again.

                      I can't find any cjpegli.exe or djpegli.exe in google search.
                      Perhaps Windows people won't touch this.
                      Funny that. :-(

                      1. [5]
                        Wes
                        Link Parent
                        I'm pretty confused, because libc should be included in basically every Linux distro. I can only guess that it's running in an extremely locked down environment like Docker, or a bare bones Linux...

                        I'm pretty confused, because libc should be included in basically every Linux distro. I can only guess that it's running in an extremely locked down environment like Docker, or a bare bones Linux distro designed for IoT or something.

                        In any case, I'm sorry I couldn't be of more help. Best of luck in finding an alternative solution.

                        3 votes
                        1. [4]
                          bitwyze
                          Link Parent
                          It is included in every distro, but you two have different versions based on which OS you're running. It could be that one of you is very out-of-date, or just that one distro is a bit behind....

                          It is included in every distro, but you two have different versions based on which OS you're running. It could be that one of you is very out-of-date, or just that one distro is a bit behind. Since yours was linked against one version and OP has a different one on their system, it's failing to link properly. This is one of the reasons containerization has gotten so popular.

                          Also, a .so file is a shared object file (a .dll in Windows) which is dynamically linked. A .a file is a statically linked library (I don't remember what windows calls their static libraries? .lib or something?)

                          2 votes
                          1. [3]
                            Wes
                            Link Parent
                            I'm on a rolling release, so probably too recent. It seems like glibc can be statically linked, but it's highly discouraged on Linux. I guess the solution is to simply build from an older system...

                            I'm on a rolling release, so probably too recent.

                            It seems like glibc can be statically linked, but it's highly discouraged on Linux. I guess the solution is to simply build from an older system for wider compatibility.

                            Sharing libraries may once have made sense for saving disk space, but fully packaging and containerizing tools definitely seems like the way forward.

                            1. [2]
                              Fishtail_Parka
                              (edited )
                              Link Parent
                              Hi It's hit and miss linking with the different Linux versions. I suppose jpegli team will eventually release v0.0.1 builds. e.g 64-bit Linux static. In the meantime I think 32-bit cjpegli.exe...

                              Hi
                              It's hit and miss linking with the different Linux versions.

                              I suppose jpegli team will eventually release v0.0.1 builds. e.g 64-bit Linux static.

                              In the meantime I think 32-bit cjpegli.exe might work with wine.

                              I don't mind if this thread quietly goes to sleep now.

                              So long, and thanks for all the fish. :-)

                              1. Fishtail_Parka
                                (edited )
                                Link Parent
                                Hi I've found a Windows 64-bit build. Looks like it was compiled on April 19 2026. And it runs OK with wine. :-) ~ $ wine cjpegli picture.png picture.jpg --chroma_subsampling=420 -d 2.5 Read...

                                Hi
                                I've found a Windows 64-bit build.
                                Looks like it was compiled on April 19 2026.
                                And it runs OK with wine. :-)

                                ~ $ wine cjpegli picture.png picture.jpg --chroma_subsampling=420 -d 2.5
                                Read 768x768 image, 680144 bytes.
                                Encoding [YUV420 d2.500 AQ p2 OPT]
                                Compressed to 27023 bytes (0.367 bpp).
                                768 x 768, 23.807 MP/s, 1 threads.
                                
                                ~ $ exiftool picture.jpg
                                ExifTool Version Number         : 13.59
                                File Name                       : picture.jpg
                                Directory                       : .
                                File Size                       : 27 kB
                                File Modification Date/Time     : 2026:08:06 19:54:22+01:00
                                File Access Date/Time           : 2026:08:06 19:54:22+01:00
                                File Inode Change Date/Time     : 2026:08:06 19:54:22+01:00
                                File Permissions                : -rw-r--r--
                                File Type                       : JPEG
                                File Type Extension             : jpg
                                MIME Type                       : image/jpeg
                                Image Width                     : 768
                                Image Height                    : 768
                                Encoding Process                : Progressive DCT, Huffman coding
                                Bits Per Sample                 : 8
                                Color Components                : 3
                                Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
                                Image Size                      : 768x768
                                Megapixels                      : 0.590
                                
                                ~ $ dssim picture.png picture.jpg
                                0.00191435	picture.jpg
                                
  2. teaearlgraycold
    (edited )
    Link
    This is a great use case for an LLM agent like Claude Code. OpenCode will let you use their LLM a bit for free.

    This is a great use case for an LLM agent like Claude Code. OpenCode will let you use their LLM a bit for free.

    3 votes
  3. [2]
    DistractionRectangle
    (edited )
    Link
    So what I like to do when trying to build a project is poke around their .github/workflows if they have any. In this case, it looks like they have the build process documented in release.yaml....

    So what I like to do when trying to build a project is poke around their .github/workflows if they have any. In this case, it looks like they have the build process documented in release.yaml. Edit: I like to reference the workflows directly because sometimes the written docs aren't up to date with the actual build process. (edit edit: whoops, linked to build_test, not release, fixed)

    If you need further help distilling this into a local build script, add what platform you're trying to compile for (e.g. distro + version + cpu arch) and one of the other tildren will probably help you before I find the time to take a stab at it.

    Aaaand they already did.

    1 vote
    1. DistractionRectangle
      Link Parent
      @Fishtail_Parka build.sh #!/usr/bin/env bash # yanked steps from ubuntu_static_x86_64 job in https://github.com/google/jpegli/blob/main/.github/workflows/release.yaml mkdir -p ./jpegli-tools...

      @Fishtail_Parka

      build.sh
      #!/usr/bin/env bash
      
      # yanked steps from ubuntu_static_x86_64 job in https://github.com/google/jpegli/blob/main/.github/workflows/release.yaml
      
      mkdir -p ./jpegli-tools
      docker run --rm -i -v ./jpegli-tools:/output ubuntu:latest /bin/bash << 'EOF'
      
      apt update
      DEBIAN_FRONTEND=noninteractive apt install -qqy \
              asciidoc \
              clang \
              cmake \
              doxygen \
              graphviz \
              libgif-dev \
              libgtest-dev \
              libjpeg-dev \
              libopenexr-dev \
              libpng-dev \
              libwebp-dev \
              ninja-build \
              pkg-config \
              git \
          #
      
      export CC="clang"
      export CXX="clang++"
      
      # include -b <release tag> to clone a specific version
      git clone --recurse-submodules --depth 1 https://github.com/google/jpegli.git
      
      cd ./jpegli
      
      SKIP_TEST=1 \
      ./ci.sh release \
          -DJPEGLI_DEP_LICENSE_DIR=/usr/share/doc \
          -DJPEGLI_STATIC=ON \
          -DBUILD_TESTING=OFF \
          -DJPEGLI_ENABLE_JPEGLI_LIBJPEG=OFF \
          -DJPEGLI_ENABLE_OPENEXR=OFF \
          -DJPEGLI_ENABLE_DEVTOOLS=OFF \
          #
      
      cp ./build/tools/cjpegli /output
      cp ./build/tools/djpegli /output
      EOF
      
      

      Seems to work in my limited testing. Built in ubuntu, ran on arch host.

      Edit: There's also instructions for a windows build in release.yaml

  4. kacey
    Link
    May I ask if you're trying to link against it for perf reasons, or just to try out the library? If the latter, it looks like someone might've compiled it to wasm here. Can't vouch for it, though,...

    May I ask if you're trying to link against it for perf reasons, or just to try out the library? If the latter, it looks like someone might've compiled it to wasm here.

    Can't vouch for it, though, so it might steal your photo, download a car, or hack into your mainframes. Please do exercise caution.