Skip to content
A simple image resizing server for ASP.NET
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


ImageDis is middleware that exposes an endpoint on your website which allows you to upload new images, and retrieve the original or resized variants of that image.

Getting Started

First you'll need to grab the latest packages from NuGet.

Once the packages have been added to your project, attach ImageDis to your request pipeline like the below code snippets. In this example we're telling ImageDis what storage and image transform provider to use.

using ImageDis;
using ImageDis.AspNet;
using ImageDis.S3;
using ImageDis.ImageProcessor;
app.UseImageDis(new ImageDisOptions(
    new S3StorageProvider(
    new ImageProcessorImageTransformProvider()

Uploading an image

The following is only an example snippet but demonstrates the POST required to upload an image. The image will be uploaded to the configured storage provider. The name of the file does not matter as ImageDis will grab the first image submitted.

<form action="/imagedis" method="post" enctype="multipart/form-data">
    <input name="image" type="file" />
    <button type="submit">Submit!</button>

On a successful upload, the POST responds with a json object detailing the key that this image can be referenced with. You would typically store this key for later reference when wanting to retrieve the image.

    "key": "iNaso4as9Dnro1InAs9041mwoapsdD2d",
    "url": ""

Retrieving an image

To retrieve an image, simply make a GET request to the same /imagedis endpoint, including the key of the image, e.g. This will redirect the client to the originally uploaded image.

Retrieving a resized image

You can also retrieve resized variants of images by passing additional query string parameters. ImageDis will resize and save these variants to the storage provider, using the configured image transform provider. These parameters are:

  • w (integer) - the new width of the image in pixels.
  • h (integer) - the new height of the image in pixels.
  • padded (boolean) - whether to pad the image instead of cropping when the dimensions don't match the original image ratio.

Example requests:

  • - will resize the image to a width of 300 and a height that maintains the original images aspect ratio.
  • - will resize the image to a width and height of 300px, center and then crop parts that won't fit within the new aspect ratio.
  • - will resize the entire image to fit a width and height of 300px, and will fill the rest of the image with padding to ensure it is 300x300.


It's still early days for ImageDis and the library is extremely basic. If you have any requests, let me know or contribute by making a pull request.

You can’t perform that action at this time.