Content Aware Image Resizing

Today, I read about this very cool and fast content aware image resize library written in Go. I was wondering if this functionality could be integrated in Hugo, or would it be better to do this sort smart image resizing at another stage (at the build process for example). It has a CLI.

It turned out too slow for real use, and also it can severely mess up certain image types (before -> afterSource).

For thumbnails, I’ve had good experiences with as used in my own
It’s fast enough to generate thumbnails for my galleries, certainly compared to that is abysmally slow because the smart crop is done in Python, but I wouldn’t want hugo to be generating thumbnails using smartcrop every single time I run it.

If you look at the Fill examples here:

I agree that something like smartcrop would be convenient, but you can do the same today with Hugo by setting the anchor position in Fill. And note that we cache the processed imgages intelligently in Hugo. It would not work for auto-galleries …

1 Like

That’s great! We should thus be able to create photo galleries entirely within Hugo with no external tools, using content bundling as introduced in 0.3.2.

The only thing I can see remaining would be a way to extract each image’s front matter like caption, geolocation, camera/lens/aperture/ISO from its EXIF/IPTC/XMP metadata.

Yea, that is a known limitation using Go’s std lib only. But we will eventually get there.