Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Dec 3, 2015

readme.md

Tinify

C# wrapper for the Tinify (TinyPNG) API.

The Tinify API allows you to compress and optimize JPEG and PNG images.

Usage

// Init a new instance of the class.
var tinify = new Tinify("--your-api-key-from-tiny-png--");

// Upload and shrink an image.
var resp = tinify.Shrink(Server.MapPath("~/wallhaven-88501.jpg"));

If you specify a second file in the Shrink function, it will automatically download the shrinked file. You can also pass along credentials and info to tell tiny-png to upload the shrinked file directly to Amazon S3.

The response object you get back from the wrapper can be used to scale, fit, or adjust the image before downloading it again.

// Create a cover with the uploaded image.
tinify.Cover(resp, 200, 200, Server.MapPath("~/wallhaven-88501-tinify-cover-200x200.jpg"));

// Create a thumbnail with the uploaded image.
tinify.Fit(resp, 200, 200, Server.MapPath("~/wallhaven-88501-tinify-fit-200x200.jpg"));

// Scale the uploaded image.
tinify.Scale(resp, 0, 200, Server.MapPath("~/wallhaven-88501-tinify-scale-200x200.jpg"));

The HTTP status code and description from the last request can be found in the tinify.LastHttpStatusCode and tinify.LastHttpStatusDescription respectivly.

About

C# wrapper for the Tinify (TinyPNG) API.

Resources

Releases

No releases published

Packages

No packages published

Languages