Please guide me about showing bluring effect (incresing..and at end image feds) for a picture / image bos in Timer event.
How to blur an image
Collapse
X
-
Tags: None
-
Just a quick thought off the top of my head...Originally posted by wajerupaliPlease guide me about showing bluring effect (incresing..and at end image feds) for a picture / image bos in Timer event.
What about looping through the pixels using the Point() function, and setting each chunk of, say, four pixels, to the average colour of all four? In other words, say the values of the first few pixels in your image were...
5 10 15 20You could try setting them to...
8 12 10 38
9 9 21 21I imagine you'd get better results if you split the values into R/G/B components first, then averaged each of them, then combine the average values to produce the actual colour.
9 9 21 21
If nobody comes up with a better answer (unlikely) and if I can find the time (very unlikely) I'll try to throw together a bit of sample code to demonstrate this idea. And to see whether it works, I suppose - remember I've just made this up on the fly. -
This code works on similar lines to produce blur effect. Take 3 picture boxes and picture 1 finaly has the effect
Picture1.Pictur e = Picture2.Pictur e
Dim barheight As Integer, barno As Integer, i As Long
Dim r As Single
r = h / w
barheight = 200
On Error Resume Next
barno = w / barheight + 300
For i = 1 To barheight + 100
For j = 0 To barno
Picture1.PaintP icture Picture3.Pictur e, j * barheight, 0, i, h, j * barheight, 0, i, h
Picture1.PaintP icture Picture3.Pictur e, 0, r * j * barheight, w, i * r, 0, r * j * barheight, w, i * r
Next
DoEvents
NextComment
-
I'll have to see if I can find time to try out this code. However, just at a glance it looks to me as though you are working with "twips". This is all very well, but I think you'll find things execute considerably faster if you work with pixels. The number of twips per pixel varies depending on your setup, but in my case it's 15. That means for every one pixel shown on the screen, you could be doing calculations for 225 points.Originally posted by wajerupaliThis code works on similar lines to produce blur effect. Take 3 picture boxes and picture 1 finaly has the effect
...
If you're unfamiliar with how it all works, just try setting the Scalemode property ti "3 - pixel". And you may need to use properties such as ScaleHeight instead of Height, and so on.Comment
-
I had to change a few things around to get it to run, and it did produce an interesting checkerboard sort of effect as it filled in the picture. But I don't see any blurring, just a copy of the original image.Originally posted by wajerupaliThis code works on similar lines to produce blur effect. Take 3 picture boxes and picture 1 finaly has the effect
...Comment
Comment