Image processing 50% of original size for srcset retina images

Hi,

I’d like to take advantage of Hugo’s image processing for generating retina images. Typically I’d use srcset with two src’s 1x and 2x, with the 1x being exactly half the size of the 2x image.

It would be great to just be able to save a 2x “retina” version of an image and have Hugo automatically downsize the 2x by 50% to a 1x non-retina version (instead of me having to manually create two assets).

I’ve seen the following snippet in the docs

// Resize to a width of 600px and preserve ratio
{{ $image := $resource.Resize "600x" }} 

However I’m unsure if you could do the following

// Resize to a width of 50% and preserve aspect ratio
{{ $image := $resource.Resize "50%" }} 

Is this doable?

Thanks

I don’t know the answer, but you’re gonna build the resize code either way, ne? It doesn’t look like it will work, but you can try. :slight_smile: