digirati-co-uk / iiif-net

IIIF models for dotnet
MIT License
3 stars 1 forks source link

Add `SizeParameter.Resize()` method #47

Closed donaldgray closed 3 months ago

donaldgray commented 3 months ago

Helper method for SizeParameter that will resize given Size according to param values.

This is accordance to IIIF ImageApi 3.

All values are supported with the exception of ^max as we don't know maxWidth, maxHeight or maxArea.

Note that behaviour of this method can be controlled - for w,, ,h, pct:n and w,h where the values "MUST NOT be greater than XX" this method will throw an exception, or return the original size depending on value of InvalidUpscaleBehaviour enum (defaults toInvalidUpscaleBehaviour.Throw).

e.g. Image 200x200 and SizeParamter /500,/ will return 200x200.