C++ C++ C# C# ASP.NET Security ASP.NET Security ASM ASM Скачать Скачать Поиск Поиск Хостинг Хостинг  
  Программа для работы с LPT портом...
Язык: .NET — ©Alexey...
  "ASP.NET Atlas" – AJAX в исполнении Micro...
Язык: .NET — ©legigor@mail.ru...
  "Невытесняющая" Многопоточность...
Язык: C/C++ — ©...
  Update World C++: Сборник GPL QT исходников
  Весь сайт целиком можно загрузить по ссылкам из раздела Скачать

 Fireball.Core FreeImage Wrapper / Graphics / C#

Free Image Demo Example


Fireball.Core is class library developed with C#, with the objective to integrate an API that I need for my daily work, and as a base for my other open source libraries. In this article, I can only describe the FreeImage class, but on the Fireball.Core library there are some other classes presented as well.


FreeImage is the best open source class library for manipulating images. To get the Fireball.Core library working, you need to download it from SourceForge. The binary version for Windows is to be downloaded and put on C:\Windows\System32. I also provide here a little example project, for showing how simple it is to use it, but the example is incomplete and the wrapper needs more work.

Using the code

Using the FreeImage wrapper is very simple, you need only to reference the Fireball.Core.dll on your project and add an using directive and instanciate the class with a filename.

using System;
using System.Drawing;

public class test

    FreeImage _fi = null;

    public void LoadImage(string filename)
        _fi = new FreeImage(filename);

Now, you have the image file loaded. On that image, you can apply a rotation, a brightness change or contrast. See the example that applies a rotation, here:

    public void Rotate(double angle)

Example: if you call test.Rotate(25); you have applied to your image a left rotation of 25 degrees!!

For a more detailed class view, see this image exported from the Visual Studio class diagram.

Now, for applying some effects, I am implementing a FreeImageTrasformation class that is a base class for all transformation classes, like FreeImageRescale. For example, you have a 1240 x 1200 image, and you need to rescale it to 800 x 600; you can do that simply with two lines of code:

FreeImageRescale rscTransform = new FreeImageRescale(800, 600);

That is all for now! I don't have more time for writing. FreeImage is also the best when you need to manipulate big images, because the Bitmap class of the .NET framework doesn't support big images. If you are interested to contribute to this project, you can join the Fireball community by simply registering on the Fireball forums. On my website, you can find nightly builds on the download section. All code are under the terms of the LGPL license that gives you the possibility to link the library on to your commercial projects without the need to redistribute your code! You only need to enclose a lgpl.txt file on the same directory where the Fireball.Core library is located, with a link to my website. Any reference on your About message is very much appreciated ;)

Points of Interest

Please contribute to the Fireball project!

Letyshops [lifetime]