blurring images is also very easy.
the simplest technique is to resize the original image to a much smaller size, and then resize it to the original size.
the reason is very obvious, when we enhance the dimensions of any image we have a loss of quality, causing the blur effect.
requires vfp9 and gdiplusx to run.
please make sure that you have the latest version!
http://www.codeplex.com/vfpx/wiki/view.aspx?title=gdiplusx&referringtitle=home
* init gdiplusx
do locfile("system.app")
with _screen.system.drawing
* load source image
local lobmp as xfcbitmap
lobmp = .bitmap.new(getpict())
* get a rectangle with the bitmap dimensions
local lorect as xfcrectangle
lorect = lobmp.getbounds()
* initialize the graphics object to be able to draw in the image
local logfx as xfcgraphics
logfx = .graphics.fromimage(lobmp)
logfx.clear(.color.white)
local lnreducefactor as integer
lnreducefactor = 10 && the image will be reduced in 10 times
* get the thumbnail with the desired size
local lodestbmp as xfcimage
lodestbmp = lobmp.getthumbnailimage(lobmp.width / lnreducefactor, lobmp.height / lnreducefactor)
* draw the image, showing the intensity of the cyan channel.
logfx.drawimage(lodestbmp, lorect)
lobmp.save("c:\blurred.jpg", .imaging.imageformat.jpeg)
run /n explorer.exe c:\blurred.jpg
endwith
return
original image
factor = 4
factor = 8
factor = 8
factor = 12
factor = 20
original image
factor = 4
factor = 8
factor = 12
factor = 20
No comments:
Post a Comment