Open Winterhuman opened 1 year ago
Example use-case: Generating an image based on the value of .Pages.
What type of images do you think about here?
Something like what I do with this script. Where it takes a number for the filled-in pixel count (.Pages
), finds the minimum dimensions for a given aspect ratio and the pixel count, and then simply fills the number of pixels passed to the script
Netpbm defines a set of plaintext and binary file types which can be converted into images, as an example:
Being able to use Portable Anymap Format (PNM) files as the input (and potentially output too) for
convertTo
and related functions would be amazing, since it would enable programmatically generating images from within Hugo. Example use-case: Generating an image based on the value of.Pages
.Right now, this can be achieved by setting an environment variable to the Hugo variable's value, and then using a separate script to generate and convert the PNM files, however, Hugo doesn't support executing external scripts upon running
hugo
so this isn't very convenient if you have many images which change often.Existing Go library: https://github.com/spakin/netpbm (might be too old, looks like libraries for separate types such as PPM are more up-to-date: https://github.com/lmittmann/ppm)