Image Resizing

This sample shows how the NPM module sharp can be used for dynamic image resizing from within an ASP.NET Core application. There is one copy of the following image on disk, but we can set up an MVC action method that returns it resized to fit within an arbitrary width and height.

Dependencies: On Windows and Linux, there are no native dependencies. Just running npm install is enough. On OS X, however, you need to have libvips installed, which you can get through Homebrew by running brew install homebrew/science/vips.

100px wide [open]

200px wide [open]

400px wide [open]

800px wide [open]

Credit: Parrot by D Coetzee is dedicated to the public domain (CC0)