ImageResizer: how do you use instructions?

The documentation for ResizeSettings says: "Replaced by the" Instructions "class http://documentation.imageresizing.net/docu/ImageResizer/ResizeSettings.htm

The documentation for the instructions says: "Successor to ResizeSettings." http://documentation.imageresizing.net/docu/ImageResizer/Instructions.htm

However, I cannot figure out how to use instructions instead of ResizeSettings. I tried

  • Google
  • Documentation (documentation.imageresizing.net)
  • View Object Browser for instructions
  • Search ImageResizer.dll in .net Reflector for instructions
  • Decompiling the entire ImageResizer.dll file and searching through the resulting code.

If the commands replace ResizeSettings, then how can I use it instead of ResizeSettings?

=== Edit - more details:

This way to use ResizeSettings:

public static Bitmap Resize(Bitmap bitmap, int maxHeight, int maxWidth) { var setting = new ResizeSettings { MaxHeight = maxHeight, MaxWidth = maxWidth, }; return ImageBuilder.Current.Build(bitmap, setting); } 

Reading this Instruction was a replacement for ResizeSettings, one of the first things I tried was this: (I was hoping ImageBuilder might have an overloaded Build method)

  public static Bitmap Resize(Bitmap bitmap, int maxHeight, int maxWidth) { var instructions = new Instructions { Width = maxWidth, Height = maxHeight, Mode = FitMode.Max }; return ImageBuilder.Current.Build(bitmap, instructions); } 
+4
source share
1 answer

In an unexpected turn of events, documentation is ahead of reality.

You can use the Instructions class, but now you must first convert it to a ResizeSettings instance as follows:

 .Build(source, dest, new ResizeSettings(new Instructions("width=20"))); 

In the next major release, this will take directly the Instructions class.

+5
source

Source: https://habr.com/ru/post/1486346/


All Articles