# Pre-processing images?

**URL:** <https://discourse.gohugo.io/t/pre-processing-images/36314>\
**Category:** support\
**Created:** [January 2, 2022, 5:21am UTC](https://discourse.gohugo.io/t/pre-processing-images/36314 "2022-01-02T05:21:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![angusm](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@angusm](https://discourse.gohugo.io/u/angusm)\
**Post date:** [January 2, 2022, 5:21am UTC](https://discourse.gohugo.io/t/pre-processing-images/36314/1 "2022-01-02T05:21:38Z")

</div>

I’m working on tools to build a ‘photo-a-day’ website, to display a collection of 365 images taken over the course of a year. Each image has a page of its own; there are also 12 ‘month pages’, which show thumbnails for each month’s photos, plus a homepage.

My current approach is to use a `gulp` build script that reads the EXIF/IPTC data from the photographs and uses it to generate a ‘day page’ for each picture. `hugo` then builds the site from these pages. The `gulp` script also generates copies of the photographs at multiple different resolutions, ready for display.

I’m aware that `hugo` has image-processing tools, so that I could probably replace the image-resizing part of the `gulp` script with native `hugo` features. However, as far as I can see, `hugo` doesn’t support any kind of pre-processing step that would let me iterate over all the available photographs and write a Markdown file for each one (with front-matter based on the EXIF/IPTC data in the photo).

My impression from reading the documentation and the forums is that this kind of pre-processing is not The Hugo Way, and that doing it with a separate build tool such as `gulp` is in fact the preferred alternative. But I just wanted to check that this impression is correct, and that there isn’t some clever way that I could use `hugo` for this task, and eliminate `gulp` from my build process.

Comments? Suggestions?

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [January 2, 2022, 5:49am UTC](https://discourse.gohugo.io/t/pre-processing-images/36314/2 "2022-01-02T05:49:10Z")

</div>

It can be done by nesting a project used for prebuilding within the main project and mounting its public folder as the content folder of the parent.

See this article for a step-by-step: [Toward using a Headless CMS with Hugo: Building Pages from an API | The New Dynamic](https://www.thenewdynamic.com/article/toward-using-a-headless-cms-with-hugo-part-2-building-from-remote-api/)

A possible caveat is that you will no longer have control over the filenames of the generated image resources.

But the benefit will be removing Gulp altogether from the build.

---

<div class="post-metadata">

**Author:** ![angusm](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@angusm](https://discourse.gohugo.io/u/angusm)\
**Post date:** [January 2, 2022, 2:31pm UTC](https://discourse.gohugo.io/t/pre-processing-images/36314/3 "2022-01-02T14:31:02Z")

</div>

Thank you. That’s very helpful.

It’s one of those solutions that is simultaneously elegant and horrible. I have to decide whether nesting `hugo` projects is better or worse than creating a dependency on `gulp` and all its baggage. But that’s certainly given me something to think about.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [January 8, 2022, 8:00am UTC](https://discourse.gohugo.io/t/pre-processing-images/36314/4 "2022-01-08T08:00:34Z")

</div>

Closed on January 8, 2022, 8:00am UTC

This topic was automatically closed after 4 days. New replies are no longer allowed.
