by DivineTraube on 6/22/17, 2:11 PM with 37 comments
Thumbor (http://thumbor.org/ ) is a tool that can be installed locally in an application architecture. However, it is focused on cropping & resizing, though it can also transcode to WebP and call external optimizers.
What is the most complete solution you are aware of that compresses & optimizes png, jpeg, and webp and can be operated on a server? It should not only be able to optimize as part of the build process but also in response to user-generated content.
by wsxiaoys on 6/22/17, 5:55 PM
Snippets:
1. Resizing with imagemagick: https://bash.rocks/Gxlg31/3
2. Resizing and convert to webp: https://bash.rocks/7J1jgB/1
After creating the snippet, you could either use GET https://bash.rocks/0Be95B (query parameters become environment variable) or POST https://bash.rocks/jJggWJ (request body become stdin).
It's not hard to roll your backend like this for private usage (simply exec from node). I'm also working on an open source release.
by matrix on 6/22/17, 5:48 PM
by Theodores on 6/22/17, 5:44 PM
As for metadata, today I decided to add it back in.
https://www.gs1.org/sites/default/files/docs/gdsn/Product_Im...
For ecommerce it will eventally help to have product data, e.g. brand, product name etc embedded in the image.
My other tip if you go the Imagemagick/PAGESPEED route then you can use 4:2:2 colour space and ditch half the bits used for chroma.
by tobltobs on 6/22/17, 4:08 PM
The only tool I ever found which does this job reliable even for huge images is http://www.vips.ecs.soton.ac.uk .
by cbr on 6/22/17, 5:59 PM
It compresses and optimizes png, gif, and jpeg, creates webp for browsers that support it, inlines small images into your html, longcaches images, and even creates srcsets.
by fweespeech on 6/22/17, 3:20 PM
Tbh the UGC side is just triggering the "build process side" as the upload occurs.
As far as best,
https://github.com/MediaCrush/MediaCrush/blob/b32e2752d1a19d...
I'd suggest you look there for some decent examples of how to go about it. They may be defunct but I use a similar approach (slightly different knob tweaks with the same binaries) and it works fine. May not be 100% optimal but its good enough imo.
by vladdanilov on 6/22/17, 3:26 PM
by ikennachifo on 6/24/17, 12:02 AM
by eeeps on 6/22/17, 6:21 PM
Images are complicated and important enough that I don't see that changing any time soon.
by rawrmaan on 6/22/17, 3:50 PM
by NicoJuicy on 6/22/17, 3:57 PM
by r1ch on 6/22/17, 3:23 PM
Be especially careful with these utilities when running them on UGC. PNG / JPEG bombs can easily cause OOM or CPU DoS conditions etc.
by logicuce on 6/23/17, 3:09 AM
It works really well for UGC as an ondemand optimizer but you can easily make some URL calls to include it in the build time as well.
by v3ss0n on 6/22/17, 3:39 PM
by focusgroup0 on 6/22/17, 4:19 PM
by tmaly on 6/27/17, 8:45 PM
I originally tried to use Google Pagespeed but I was getting some strange error message from image compression.
by nielsole on 6/22/17, 6:53 PM
by Mojah on 6/22/17, 4:09 PM
by silasb on 6/22/17, 3:34 PM
by iamonuwa on 6/24/17, 10:56 AM
However with the recent addition by cloudinary (https://webspeedtest.cloudinary.com), the tool is awesome for me.
by tyingq on 6/24/17, 3:28 AM
by anilshanbhag on 6/22/17, 3:18 PM