Re: Sharpen an Image File



> I have an image file that I am stretching proportionately (height and
> width), but the result is a slightly blurred image. Is there any APIs I can
> use that would somehow sharpen the image or anti-alias it slightly.
>
> Yours more in hope than expectation! Thanks again for the support of the
> group.

AFAIK there is something in GDI+ but people seem to have a great deal of problems using it from the number of posts
about it on the GDI groups, so your alternative is to write the filter yourself - Have a look at the "Edge detection /
Edge snap / Filter kernel" demo on my site which includes a generic filter kernel class that can be set to a sharpen
matrix. The SetSharpen() method of the class set's this kernel up for you and looks something like this:

-1 -1 -1
-1 9 -1
-1 -1 -1

The centre weight must be one higher than the sum of the surrounding values (otherwise you end up with an edge-detection
kernel rather than an edge enhancement kernel), however if you find the effect too sharp then drop the surrounding
values towards 0 and re-weight the kernel to 1, you can do this by calling SetSharpen() with an input weight of less
than 1. Obviously calling it with an input weight of more than 1 enhances the effect, but can lead to some strange
results when going too high.
Hope this helps,

Mike

P.s. If you scale your image with the Halftone interpolation mode set then the scaling algorithm performs some degree of
edge sharpening for you.


- Microsoft Visual Basic MVP -
E-Mail: EDais@xxxxxxxx
WWW: Http://EDais.mvps.org/


.


Loading