HUGO

Ho do I convert a generic resource to image resource?

I have a branch of Hugo for personal use to create PNG files from SVG source files.
I’ve implemented this as a resource transformation (source). It’s very useful for me, but will probably never be good and fast enough to be merge upstream. It’s using Inkscape for now.

The source SVG asset is a generic resource. That’s because it’s not supporting the usual image operations.
The output is a PNG and could support the operations, e.g. “Resize”.

Now I wanted to use these operations on the output file, but Hugo printed <file> is not an image (source)[https://github.com/jansorg/hugo/blob/de4d1f121e09cd7bf5d43139b9a5f52ada0dde4e/resources/transform.go#L269].

As far as I understand after digging into the sources, a transformation keeps the same type, so I can’t transform a generic resource into an image resource.

Does someone know a way how to tell Hugo that the result (i.e. the PNG) is an image resource and not a generic resource?

Thank you,
Joachim

You are writing PNG quite often in your question… I can’t find PNG as format in the Hugo documentation. Are you sure it’s available yet? As far as I know it’s just JPG right now.

PNG is supported, among other formats. https://gohugo.io/content-management/image-processing/#target-format
Inkscape can only convert svg to png, that’s why I was referring to png.

I think the bottom line here is that Hugo’s image handling does not support SVG. So, even if you somehow “told Hugo” to convert a generic resource to image resource, it wouldn’t know how to do so …