5,699,431 members and growing! (24,259 online)
Email Password   helpLost your password?
Languages » C# » General     Beginner License: The GNU Lesser General Public License

A C# image enhancement filters library

By Roiy Zysman

A set of filters to modify and style your images and photos
C# 2.0, C#, Windows, .NET, Visual Studio, Dev

Posted: 18 Nov 2006
Updated: 11 May 2007
Views: 54,845
Bookmarked: 104 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
44 votes for this Article.
Popularity: 7.58 Rating: 4.61 out of 5
0 votes, 0.0%
1
2 votes, 4.5%
2
2 votes, 4.5%
3
5 votes, 11.4%
4
35 votes, 79.5%
5

Library Home Page

Screenshot - box_colors2.png

Introduction

This project started from a need. A need to have a simple image/photo .NET filters functionality to style and enhance pictures to be displayed on the web (or any other place for that matter). True, there are some filter libraries scattered around the web for doing stuff like a WaterMark or a GrayScale or even a collection of those (ImageMagick). In most cases they are very basic or unhelpful for styling images. Furthermore, the .NET System.Drawing.* namespace doesn't provide any basic or sophisticated capabilities. For example, there isn't a proper rotate or resize functionality. So the goal was to collect all of the nice .NET filters that are out there into a single package and to extend it by providing more useful and styled filters.

Implementation

From the need that was described above I've created YAEL, which stands for: Yet Another Image Enhancement Library.

It is just a framework and filter classes. No UI (for now). The framework is very basic and simple so that extensions can easily be developed.

There is a basic IFilter interface and a BasicFilter abstract class. All of the filters derive from the BasicFilter class.

Current library filters consist of

  • Resize
  • Rotate
  • Grayscale
  • Rounded Corners
  • Boxing
  • Drop Shadow
  • Polaroid frame
  • Text and wartermark captions
  • Image watermark
  • Floor Reflection
  • FishEye
  • Skew
  • And more to come...

Here are some Samples:

Screenshot - grayScale_brighter.png

Screenshot - rotate_minus_30.png

Screenshot - rounded_35.png

Screenshot - box_colors2.png

Screenshot - dropShadow.png

Screenshot - dropShadow.png

Screenshot - text_water_middle_left.png

Screenshot - image_watermark_pacman.png

Screenshot - image_fisheye_default.png

Screenshot - image_floor_reflection.png

Screenshot - image_skew_plain.png

Usage

Usage is very straightforward. All you have to do is reference the library assemblies, load up an image, initialize a filter, execute the filter, and save back the transformed image.

Here is a sample:

static void Main(string[] args)
{
    Image myImg = Bitmap.FromFile("cat.jpg");
    Image transformedImage;
    ZRLabs.Yael.BasicFilters.TextWatermarkFilter watermark = new 
        TextWatermarkFilter();
    ZRLabs.Yael.BasicFilters.BoxFilter box = new BoxFilter();
    ZRLabs.Yael.BasicFilters.BlackAndWhiteFilter blackAndWhite = new 
        BlackAndWhiteFilter();

    //A text watermark example

    watermark.Caption = "Test";
    watermark.AutomaticTextSize = true;
    transformedImage = watermark.ExecuteFilter(myImg);
    transformedImage.Save("cat_watermark.png", 
        System.Drawing.Imaging.ImageFormat.Png);

    //A boxing example

    transformedImage = box.ExecuteFilter(myImg);
    transformedImage.Save("cat_box.png", 
        System.Drawing.Imaging.ImageFormat.Png);

    //A grayscale example

    transformedImage = blackAndWhite.ExecuteFilter(myImg);
    transformedImage.Save("cat_blackAndWhite.png", 
        System.Drawing.Imaging.ImageFormat.Png);
}

Update

  • 15-Dev-2006
    • V1.0.3.0 Released
      • Added the Fisheye, FloorReflection and Skew filters.
      • Added a pipeline helper class for easy and fluent transformations.
  • 28-Nov-2006
    • Added the ability to use images on the BoxFilter on the top and side panels.
      Check out the samples page for examples.
  • 27-Nov-2006
    • Added a KeepAspectRatio property to the ResizeFilter
  • 23-Nov-2006
    • Added an image watermark filter
    • Changed the license to LGPL

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License

About the Author

Roiy Zysman



Occupation: Web Developer
Location: United States United States

Other popular C# articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 56 (Total in Forum: 56) (Refresh)FirstPrevNext
QuestionDropShadowmemberadsaero6:50 28 Oct '08  
AnswerRe: DropShadowmemberRoiy Zysman13:28 31 Oct '08  
Questionhow to use the textWaterMark so that the text is upright?memberLuizItatiba9:14 15 Oct '08  
AnswerRe: how to use the textWaterMark so that the text is upright?memberRoiy Zysman0:44 16 Oct '08  
GeneralRe: how to use the textWaterMark so that the text is upright?memberLuizItatiba7:17 16 Oct '08  
GeneralFilters are available for online editing at http://www.imgtoys.commemberRoiy Zysman11:38 14 Oct '08  
QuestionAssigning two lines of CaptionmemberLuizItatiba19:51 21 Jul '08  
QuestionWhat the Validation component of the examplesmemberLuizItatiba10:25 21 Jul '08  
QuestionDoubts in relation to the background color of the filter Rounded Corners FiltermemberLuizItatiba20:06 20 Jul '08  
AnswerRe: Doubts in relation to the background color of the filter Rounded Corners FiltermemberRoiy Zysman6:30 21 Jul '08  
GeneralRe: Doubts in relation to the background color of the filter Rounded Corners FiltermemberLuizItatiba8:23 21 Jul '08  
AnswerRe: Doubts in relation to the background color of the filter Rounded Corners FiltermemberRoiy Zysman9:11 21 Jul '08  
GeneralRe: Doubts in relation to the background color of the filter Rounded Corners FiltermemberLuizItatiba9:31 21 Jul '08  
GeneralWorking with Drop Shadow filter in dark pages with fundsmemberLuizItatiba14:37 20 Jul '08  
QuestionDoubts over its code examplememberLuizItatiba13:46 20 Jul '08  
AnswerRe: Doubts over its code examplememberRoiy Zysman6:32 21 Jul '08  
QuestionRe: Doubts over its code examplememberLuizItatiba8:20 21 Jul '08  
GeneralI saw your link in Samples of http://www.dotnetclan.com/zrlabs/yael/YaelMain.htmmemberLuizItatiba17:48 18 Jul '08  
AnswerRe: I saw your link in Samples of http://www.dotnetclan.com/zrlabs/yael/YaelMain.htmmemberRoiy Zysman0:51 19 Jul '08  
QuestionRe: I saw your link in Samples of http://www.dotnetclan.com/zrlabs/yael/YaelMain.htmmemberLuizItatiba8:04 19 Jul '08  
GeneralHow to combine several images ino one?memberAndrie Kostyuk9:26 27 Jul '07  
GeneralRe: How to combine several images ino one? [modified]memberRoiy Zysman20:12 6 Aug '07  
GeneralRe: How to combine several images ino one?memberAndrie Kostyuk5:00 7 Aug '07  
GeneralCan´t use imageWaterMark.Halign ...memberLordMM0:41 11 Jun '07  
AnswerRe: Can´t use imageWaterMark.Halign ...memberRoiy Zysman11:41 12 Jun '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 11 May 2007
Editor: Sean Ewington
Copyright 2006 by Roiy Zysman
Everything else Copyright © CodeProject, 1999-2008
Web15 | Advertise on the Code Project