Browse Source

Update master

Former-commit-id: 308ee4ca61dfdf71b78d54a36dbb679f76f0bbcd
af/merge-core
James South 14 years ago
parent
commit
ea5373c90e
  1. 105
      README.md

105
README.md

@ -1,7 +1,7 @@
ImageProcessor
===============
ImageProcessor is a library for on the fly processing of image files using Asp.Net
ImageProcessor is a library for on the fly processing of image files using Asp.Net 4 written in c#.
The library architecture is highly extensible and allows for easy extension.
@ -11,18 +11,19 @@ Core plugins at present include:
- Crop
- Quality (The quality to set the output for jpeg files)
- Filter (Image filters including sepia, greyscale, blackwhite, lomograph, comic)
- Vignette
- Vignette (Adds a vignette effect to images)
- Format (Sets the output format)
- Alpha (Sets opacity)
- Watermark (Set a text watermark)
The library consists of two binaries: ImageProcessor.dll and ImageProcessor.Web.dll.
The library consists of two binaries: **ImageProcessor.dll** and **ImageProcessor.Web.dll**.
ImageProcessor.dll contains all the core functionality that allows for image manipulation via the `ImageFactory` class. This has a fluent API which allows you to easily chain methods to deliver the desired output.
**ImageProcessor.dll** contains all the core functionality that allows for image manipulation via the `ImageFactory` class. This has a fluent API which allows you to easily chain methods to deliver the desired output.
e.g.
// Read a file and resize it.
var photoBytes = File.ReadAllBytes(file);
byte[] photoBytes = File.ReadAllBytes(file);
int quality = 90;
ImageFormat format = ImageFormat.Jpeg;
int thumbnailSize = 150;
@ -39,13 +40,26 @@ e.g.
}
}
ImageProcessor.Web.dll contains a HttpModule which captures internal and external requests automagically processing them based on values captured through querystring parameters.
**ImageProcessor.Web.dll** contains a HttpModule which captures internal and external requests automagically processing them based on values captured through querystring parameters.
Using the HttpModule requires no code writing at all. Just reference the binaries and add the relevant sections to the web.config
Image requests suffixed with QueryString parameters will then be processed and cached to the server allowing for easy and efficient parsing of following requests.
e.g.
The parsing engine for the HttpModule is incredibly flexible and will **allow you to add querystring parameters in any order.**
Installation
============
Installation is simple. Download the zip file from the downloads section and copy the two binaries into your bin folder. Then copy the example configuration values from the `config.txt` into your `web.config` to enable the processor. A Nuget package will be created once I've read the manual to allow simpler installation in the future.
Usage
=====
Heres a few examples of the syntax for processing images.
Resize
======
<img src="/images.yourimage.jpg?width=200" alt="your resized image"/>
@ -57,4 +71,79 @@ e.g.
<img src="remote.axd/http://url/images.yourimage.jpg?width=200" alt="your resized image"/>
Will resize your remote image to 200px wide whilst keeping the correct aspect ratio.
Will resize your remote image to 200px wide whilst keeping the correct aspect ratio.
Crop
====
Cropping an image is easy. Simply pass the top-left and bottom-right coordinates and the processor will work out the rest.
e.g.
<img src="/images.yourimage.jpg?crop=5-5-200-200" alt="your cropped image"/>
Alpha Transparency
==================
Imageprocessor can adjust the alpha transparency of png images. Simply pass the desired percentage value (without the '%') to the processor.
e.g.
<img src="/images.yourimage.jpg?alpha=60" alt="60% alpha image"/>
Filters
=======
Everybody loves adding filter effects to photgraphs so we've baked some popular ones into Imageprocessor.
Current filters include:
- blackwhite
- comic
- lomograph
- greyscale
- polaroid
- sepia
- gotham
- hisatch
- losatch
e.g.
<img src="/images.yourimage.jpg?filter=polaroid" alt="classic polaroid look"/>
Watermark
=========
Imageprocessor can add watermark text to your images with a wide range of options:
- text
- size (px)
- font (any installed font)
- opacity (1-100)
- style (bold|italic|regular|strikeout|underline)
- shadow
- position (x,y)
e.g.
<img src="/images.yourimage.jpg?watermark=watermark=text-test text|color-fff|size-36|style-italic|opacity-80|position-30-150|shadow-true|font-arial" alt="watermark"/>
Internally it uses a class named `TextLayer` to add the watermark text.
Format
======
Imageprocessor will also allow you to change the format of image on-the-fly. This can be handy for reducing the size of requests.
Supported file format just now are:
- jpg
- bmp
- png
- gif
e.g.
<img src="/images.yourimage.jpg?format=gif" alt="your image as a gif"/>

Loading…
Cancel
Save