Question about Hugo's image processing and build time vs Gatsby Image component

Hello, friends! Now as I can see, Hugo has built-in Image Processing ability, so I can compress my .jpg (why not .png also?), generate webP, and srcset (with image resizing) too.

So now it’s nearly does the same that Gatsby Image component does, right?

I’m just worried, about what is build time will been, when I process a bunch of images from my site with Hugo? Build time will increase much more? For example, Gatsby’s build time increases dramatically, when you process the images with Gatsby Image component.

Depends. If you make sure you keep a copy of the resources directory that is created when building, then images are only rebuilt if something changes, so the first time building will take longer than plain pages, but after that it’s not a big difference.

If you are using Netlify there is a plugin that allows you to avoid storing the resources directory in your repo, and stores it in a cache on Netlify’s service. If you do store resources in your repo you will almost certainly want to use Git LFS rather than store in the regular git repo.

PNG is a losless compression format, whereas JPG is not. So PNG is already compressed, and you can’t compress it any more.

1 Like

Thank you, so I need build images only once, then they will not rebuild, if images already compressed.

Oh, I didn’t know that, thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.