HOW TO USE
If you have got one of ImageOptimizer APIs, you can easily integrate it with any
of your programs which are written on Microsft .NET framework 2.0 or later.
Here you will learn how to do this job:
1. Open/Create your project in Microsoft Visual Studio.
2. In Solution Explorer find your project and right click on it and the choose
"Add Reference...".
3. Locate the dll which you have downloaded, select it and then click "OK".
4. Go to the class in which you want to do image optimization. Put the following
code to the using section of your class:
using Geeks.ImageOptimizer.API;
5. Go to the line in which you want to do image optimization and put the
following codes there:
ImageOptimizer optimizer = new ImageOptimizer();
Image result = optimizer.Optimize(
<image filename | image>
);
6. Finished! the optimized image in now stored in result variable.
[NOTE]
There are 4 overrides for the Optimize function of ImageOptimizer class.
Here is a brief description of each.
11. If you want to give a file name and store the optimized image in a file use:
bool successful = optimizer.Optimize(
<source file path>, <destination file
path>
);
2. If you want to give an Image class and get the result in an Image class use
this:
Image result = optimizer.Optimize(
<Image instance>
);
3. If you want to give file name and get the result in an Image class, use this:
Image result = optimizer.Optimize(
<source file path>
);
4. Finally if you want to give the whole content of an image in bytes and get
the result in bytes (e.g. in web application you may use this override) use the
following code:
byte[] result = optimizer.Optimize(
<input byte array>
);