Skip to content

Add $image.Process #11483

@bep

Description

@bep

See #11476 (comment)

This works great. At some point, conversion without resizing will make it a bit easier.

Yea, well, I'm not totally happy with the original API. Having methods (Resize, Fill ... etc.) for each of these ops was a (minor) mistake, I think, as a very common thing would be to pass these ops in as strings (from config, front matter), so you end up with clumsy if statements in the template.

What I'm tempted to add is a $image.Process method which would cover all of the 4 we have today, so you could do variations on the form:

  • $image.Process "resize 200x200"
  • $image.Process "resize 200x200" webp"
  • $image.Process "fill 200x200"
  • $image.Process "crop 200x200"
  • $image.Process "webp"

The new functional thing in the above is that it would be possible to convert from, say, JPG to WebP without doing any resizing.

/cc @jmooring

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions