imazen / imageflow-dotnet

The official .NET API for Imageflow, the Rust image processing and optimization engine for web servers
GNU Affero General Public License v3.0
143 stars 25 forks source link

How to use equivalent of ImageResizer scale=both in imageflow-dotnet fluent API? #9

Closed SmilingCatEntertainment closed 4 years ago

SmilingCatEntertainment commented 4 years ago

BuildNode.ConstrainWithin seems to be the main workhorse available for resizing operations, but I don't see a way to engage something similar to scale=both from ImageResizer to allow upscaling as well as downscaling. Is there some hidden setting that I'm not seeing?

lilith commented 4 years ago

There is a command_string node that accepts "&scale=both" directly:

https://github.com/imazen/imageflow/blob/master/imageflow_types/src/lib.rs#L400-L404

lilith commented 4 years ago

You can use .ResizerCommands("scale=both&width=100&height=100&mode=max") in https://github.com/imazen/imageflow-dotnet/releases/tag/v0.3.4

lilith commented 4 years ago

You can also use .Constrain(new Constraint(ConstrainMode.Fit, w, h)) in v0.4.0