Free Trial
10 days, no credit_card

<< More Tutorials

How to resize an image to cover any dimensions in C# using rethumb?

To resize an image, with our "cover" operation, in C# use the following code:

using System.IO;
using System;
using System.Net;

class CsRethumbExample
{
    static void Main()
    {
        string paramOperation = "cover";
        string paramValue = "150x200"; // New WIDTHxHEIGHT in pixels.
        
        string imageURL = "http://images.rethumb.com/image_coimbra_600x300.jpg";
        string imageFilename = "resized-image.jpg";

        using (WebClient client = new WebClient())
        {
            client.DownloadFile(string.Format("http://api.rethumb.com/v1/{0}/{1}/{2}", paramOperation, paramValue, imageURL), imageFilename);
        }
    }
}

Start using this example now

Use the following commands to get started:

$ git clone https://github.com/rethumb/rethumb-csharp-examples.git
$ cd rethumb-csharp-examples
$ ... Use your IDE of choice to handle the file "cover.cs"

More examples using C#