Essential Image Optimization
images.guide
images.guide
It allows you to use any imagemin plugins you want, which have wrappers for most image compressors out there. And since it runs every "production build" you can commit your unoptimized images to your repo.
In the beta there is a "cache" option, and if an image exists in the cache it will just use that.
However since I use the webpack asset system I can't easily (or safely) check the output to see if it exists (because using the asset system, other plugins could completely change, rename, combine, or delete files after my plugin runs, so trying to detect those files could break things for a lot of users).
1.6 should be promoted to "stable" soon. I only put it in beta since I won't be able to completely test it till Monday. (I also screwed up and merged it into master before I realized I wouldn't be able to do the release untill Monday, so the master Readme has options that won't work in version 1.5)
1_pingo.png - 8484 --> 8454
2_pingo.png - 18540 --> 18483
4_zopfli.png - 91846 --> 91838
https://imgur.com/a/opWftI have a series of images that are basically screenshots of a visual novel (pretty much a comic book). Most of the space of the screenshots are identical from image to image, and I'd like to compress these files together to save space. My first thought is to use some kind of video compression format to do this, but I'm wondering how to handle playback (currently the windows built in image viewer is used).
Backstory: My wife enjoys reading VNs on her phone and screenshots them so she can re-read them on the PC. I've automated most of the capturing of screenshots via some adb scripting and a WPF app that talks to the phone, but the resulting files are quite large and I can tell that I could be smarter with how the resulting files are stored.
The extra steps with compositing in a Canvas first will prevent you from getting artifacts from scaling the images, but the artifacts may not be particularly visible.
If you are comfortable with NumPy this whole process should be fairly easy and painless. I have done something similar in the past, but it was for making animated GIFs.
If you are particularly adventurous, you could remove large chunks of the VN foreground by taking the per-pixel median value from a large stack of images that share a background. You could then use this as a base image.
Then you can just use any image compressor and viewer I crunch them down, hopefully leveraging the image files properties to crunch the size down.
Unlike all non-custom Gulp/Webpack/JS based tools I know, it does incremental builds so that it only resizes/optimizes images that you change or add, so it won't substantially slow down your site build times. It also rewrites the output of your existing static site generator so you don't have to do much to integrate it.
[2] https://github.com/GoogleChrome/essential-image-optimization...
I describe the whole setup step by step on my blog: https://blog.tjl.rocks/cheap-secure-and-fast-ghost-blog-set-...
People will complain over a few hundred kb of JavaScript, but a 3mb unoptimized image will be ignored.
It drives me insane!
Most of these things can be avoided by providing a link to the original.