News for hackers. Stuff that matters.
Re:Essential Image Optimization by iamphilrae on Sunday March 24, 2019 @04:43AM (#19475214)
Even lower hanging fruit than optimising compression, is actually choosing the right image format in the first place. Put simply (very simply I may add), if it’s an illustration, use PNG, if it’s a photo, use JPEG. Once we’re over that hurdle, we can go onto managing compression techniques and attempting advanced formats such as SVG and WEBP.

All too often I’ve seen people encoding 8MP photos as PNGs and wondering why they’re all 50MB in size.

Next on the hit list is outputting images at the right size. If the image is never going to be shown greater than 500px wide, save a copy that’s 500px wide. WordPress has this feature built in- learn to use it if that’s your flavour of CMS. Your bounce rate will go down, I guarantee it.

Re:Essential Image Optimization by bscphil on Sunday March 24, 2019 @07:27AM (#19475721)
This is not as surprising as it sounds to a web developer. For high quality photography purposes jpeg is bordering on useless, even more so if one isn't using Mozjpeg or guetzli to get images with reduced artifacts. Even for the most basic uses like sharing a photo with friends and family this can be a problem. For example I sent out an album of travel photos and a family member bought me a poster size print of one of them for Christmas ... using the 3200x2400 jpeg photo I had posted to Google Photos. So while if you're a web designer using stuff like big hero or background images jpeg makes sense, there are a lot of ways in which it simply doesn't cut it for most of us.

Fortunately, and _I can't emphasize this enough_, we're now in a situation where the major browsers support Webp or can have fast decoding support easily added. Webp is based on the I-frame encoder of VP8, and for lossy encoding represents a several-generations improvement over Jpeg. And it's here today. Sure, we'll all be using Avif in a HEIF container one of these days, but that isn't relevant to people building systems today.

Use WebP! For everything! Check out some comparisons between WebP and MozJPEG here: https://xooyoozoo.github.io/yolo-octo-bugfixes/#buenos-aires...

I now upload WebP and HEIC images to Google Photos, where they are both supported.

Re:Essential Image Optimization by vladdanilov on Sunday March 24, 2019 @12:56PM (#19477346)
> For high quality photography purposes jpeg is bordering on useless

> Use WebP! For everything!

Jyrki Alakuijala, one of the creators of WebP, on WebP vs JPEG [1]:

>> For high quality photography, I (and butteraugli) believe that JPEG is actually better than WebP.

>> Below JPEG quality 77 WebP lossy wins, above JPEG quality 77 JPEG wins (for photography).

>> This was based on the maximum compression artefact in an image -- averaging from 1000 images.

Better meaning here [2]:

>> Faster decode (up to around 6x faster) and less bytes needed at high quality (in comparison to butteraugli scores).

[1] https://encode.ru/threads/2905-Diverse-third-party-ecosystem...

[2] https://encode.ru/threads/2905-Diverse-third-party-ecosystem...

Re:Essential Image Optimization by bscphil on Sunday March 24, 2019 @11:02PM (#19480037)
"For high quality photography, I (and butteraugli) believe that JPEG is actually better than WebP."

That's interesting. Of course, the subjective part of that is one person's take, and the "objective" part of it is pointless because the whole point of Guetzli (the jpeg encoder) is to try to maximize the Butteraugli score, so saying that WebP gets a lower score is not significant.

Personally, WebP looks a lot better to me in the direct tests of equal file size that I've seen. It even looks better than Pik, which is Google's experimental successor to Jpeg that also uses Butteraugli.

And it would be odd, to say the least, if a codec from the early nineties could beat a modern one on Intra-frame coding, which has been a subject of immense research over the years.

Take a look at some of these for yourself. https://wyohknott.github.io/image-formats-comparison/

Re:Essential Image Optimization by lstamour on Monday March 25, 2019 @02:04AM (#19480601)
Like MP3 encoders, JPEG encoders have only gotten better over the years, perhaps they’ve fewer bugs or compromises for compression? Also, there are newer standards for JPEG including JPEG2000 and JPEG XR, etc. Plus many other alternatives: https://developers.google.com/web/fundamentals/performance/o...

So my advice is encode in multiple formats to achieve the broadest browser support and the best image quality/size trade off that you’re willing to allow. That said... it does sort of bug me that every couple years we have to revisit which codecs we’re using because the implementations keep marching on...

Re:Essential Image Optimization by matt4077 on Sunday March 24, 2019 @02:47PM (#19478009)
> For high quality photography purposes jpeg is bordering on useless

That's the sort of faux-professional hyper-contrarianism that is "bordering on detrimental".

I just checked Magnum, a somewhat professional photo agency. They use JPEG. So do the NYT, flickr, and probably the vast majority of professional and totally unprofessional websites.

It seems there is some use left in the format. Not being able to print to billboard sizes doesn't diminish this. Because (a) that use case is a rounding error, and (b) WebP is still not safe for such purposes – TIFF is.

Re:Essential Image Optimization by hexo on Sunday March 24, 2019 @04:50PM (#19478681)
TIFF is just a container. Doesnt say about encoding or compression (like AVI).

That you find web using hardcore old style JPEGs when they've been replaced by better formats long ago also doesn't mean that JPEG is really suitable way to store or share photos - especially when your display is good hi-dpi stuff. Also - do you find GIFs technologically OK for sharing animations today when there is stuff like h.265...?

Re:Essential Image Optimization by extra88 on Sunday March 24, 2019 @10:01AM (#19476375)
IE and Safari do not support WebP, Edge didn't until Windows 10 1809 (November), Firefox didn't until 65 (January) and Firefox ESR and for Android still don't.

https://caniuse.com/#feat=webp

Re:Essential Image Optimization by bscphil on Sunday March 24, 2019 @10:37AM (#19476570)
Firefox for Android does, that's outdated (see the version number). There's a fast wasm version for Safari: https://github.com/webmproject/libwebp-demo/tree/gh-pages/we...

In addition, all modern browsers support the <picture> element, which allows them to automatically download image the best meets their needs.

Re:Essential Image Optimization by extra88 on Sunday March 24, 2019 @10:48AM (#19476633)
Polyfilling WebP support just for browsers that support Web Assembly but not WebP seems pretty weighty when it's very straightforward to not exclusively use WebP.

The <picture> element is great but using it means not, as you wrote, "Use WebP! For everything!" Maybe you meant "Use WebP! For everything! With Fallbacks!"

Re:Essential Image Optimization by bscphil on Sunday March 24, 2019 @11:26AM (#19476855)
> "Use WebP! For everything! With Fallbacks!"

I can get behind that. :-)

What I meant by "for everything" was to use it for both photographic images and illustrations instead of using two different formats.

Re:Essential Image Optimization by dageshi on Sunday March 24, 2019 @09:51AM (#19476324)
I don't think Safari supports webp, on either desktop or iphone?

Until it does people will probably still be shipping jpg/png as standard.

Re:Essential Image Optimization by eps on Sunday March 24, 2019 @05:32AM (#19475370)
> All too often I’ve seen people encoding 8MP photos as PNGs

I’ve literally never seen anyone do that, leave alone this being done “often”.

Re:Essential Image Optimization by iamphilrae on Sunday March 24, 2019 @05:59AM (#19475427)
So your experience invalidates mine? I have endlessly seen website media folders throughout my 14 year career filled with PNG photographs uploaded by unknowing content editors through a CMS. This isn’t their fault, they’re writers and know no better. CMS tools should be set up by the developers to automatically convert to the right format.

Cases on the flipside includes developers using JPEG for everything. 100KB highly artifacted illustrations used throughout web layouts, which would be infinitely better as clear 10KB PNGs.

Re:Essential Image Optimization by Tomte on Sunday March 24, 2019 @08:30AM (#19475955)
No, it doesn't invalidate yours, but I'm with him. I've never seen that, either, and I cannot imagine how that could happen "often" (without doubting your experience).

Because cameras and phones give you JPEGs. The common user doesn't shoot RAW. I cannot see any not-highly-technical user convert JPEGs to anything else.

Re:Essential Image Optimization by tecleandor on Sunday March 24, 2019 @10:24AM (#19476482)
True, I've seen a lot on some clients CMSs. Classic case would be the ones uploading an screenshot of an image done on their Mac, which by default (as many OSes, anyway) outputs a PNG.
Re:Essential Image Optimization by myfonj on Sunday March 24, 2019 @06:42AM (#19475574)
And are you sure they were all real PNGs? You know, displayed suffix means nearly nothing nowadays, you can serve JPEG image as ".png" file with "image/png" mime header and browser would not even raise its eyebrow and process the JPEG properly.

I occasionally archive some imagery from web and while viewing them in Irfan I am frequently confronted with "This image is JPG with .png extension, would you like to rename it?" prompt, without what I'd probably had no idea how frequently this discrepancy occurs.

Re:Essential Image Optimization by eps on Sunday March 24, 2019 @06:48AM (#19475589)
You said

> All too often I’ve seen people encoding 8MP photos as PNGs...

And now apparently it's some CMS that was doing that... which doesn't make much sense either. Either way this is just such a patently and obviously dumb thing to do that it makes me doubt your experience is anywhere close to being statistically significant.

Re:Essential Image Optimization by Cenk on Sunday March 24, 2019 @07:03AM (#19475634)
No, they said people were uploading PNGs to a CMS, not that the CMS was doing it.
Re:Essential Image Optimization by ZeroGravitas on Tuesday March 26, 2019 @04:36AM (#19490086)
When I see this it's usually someone getting an image from a stock image site. They provide PNG because they don't know how it's going to be used by the end user and the end user doesn't know enough to understand that's a problem so you get a 4MB background image as a PNG that could be 98% smaller without any great effort.
Re:Essential Image Optimization by weavie on Sunday March 24, 2019 @05:43AM (#19475391)
Don't know about 8MP.. but I have certainly been guilty of sticking photos up as PNG before, so it is good to be aware of the difference.
Re:Essential Image Optimization by markdog12 on Sunday March 24, 2019 @11:54AM (#19476994)
I’ve seen it plenty of times