Are all JPEG compression implementations the same?

3 points by jacobwilliamroy ↗ HN
At work I recently got a bunch of images and their instructions for compressing them were basically to just open them in photoshop and save them as JPEGs. I figured I could automate this process but right now I'm running into issues because photoshop's ExtendScript is poorly documented (ChatGPT doesn't even know it). Id like to use something else but I have to know first, can I expect to get similar results from other implementations or is there something special about how photoshop exports JPEGs that makes it neccessary?

5 comments

[ 4.2 ms ] story [ 16.2 ms ] thread
No.

See https://github.com/mozilla/mozjpeg

Also, there is a fairly big problem with JPG that the ‘quality’ setting is not calibrated. That is you might look at one image and think it looks fine (which is subjective, depends on what you want to use the image for…) with a quality of 60%, but then you compress a million images at that rate, delete the originals, then you find that many of them look really awful. Not only that but there are images you could have compressed more and still been happy with the output.

If you are publishing images for the web consider using WebP which is consistently better, well supported now, and has a calibrated quality knob.

Unfortunately these images are not going to the web, they're going into a software called ARCH which expects JPEGs specifically. And also I've been told that bad things will happen if we give ARCH files bigger than 2 megabytes. The first idea I had was to export multiple versions of the same image at each quality level (0 to 12 in photoshop) and then use the RGB values of each pixel to calculate the RMSE for each one against the JPEG exported with the highest quality settings. This would be assuming that there is an RMSE which roughly corresponds to what my human eyes consider "acceptable amounts of compression artifacts." The images are so big that even though they are being compressed and checked multiple times the computer is still doing the work faster and more thoroughly than I can.

And thanks for sharing the link to mozjpeg. It's helping me to understand the differences between different jpeg encoders which is very important.

Don't bother automating Photoshop; other tools will provide very similar output.