A wish: more/smarter image options

I’ve worked on improving loading speed on several themes recently. While Pagespeed is not a perfect reflection of user experience, the fact that Google factors in whether a page is ‘fast enough’ to be a search result makes it meaningful.

A couple things that would make it easier to serve the right images to the right browser:

  1. A slightly smarter img_url format=?? option. If my client is mostly uploading pngs, then format=webp is going to be a huge reduction in loading times. But if my client has all highly compressed jpgs, then format=webp will actually make the files bigger. It would be awesome if there were a way to only convert if it makes the image smaller, or to detect what format an image was uploaded in, so that I could selectively convert to webp. As it is, I can’t optimize for a mix of images, some of which are highly compressed jpgs and should be left alone, and others are huge pngs.

  2. I’m getting hit on Pagespeed scores for loading rectangular images into square spots. (The image is the perfect width, but it’s too tall for the spot, so it gets cropped.) It’d be awesome if the img_url helper also took an aspect ratio argument, or took both width and height.