all groups > flash actionscript > may 2004 >
You're in the

flash actionscript

group:

How to count pixels in an image at flash run time.


How to count pixels in an image at flash run time. Joy_kittu
5/31/2004 7:47:43 PM
flash actionscript:
Dear members,

How to count the pixels in an image in flash on runtime..

in detail..

i have loaded an in image into my flash movie - then here I have to put a
button count pixels on the image. whenever user clicks on the button i need to
store the pixels of the image in to my text box.. how it is possible please
help me in this aspect...

or any suggetions are welcome...

bye

Re: How to count pixels in an image at flash run time. kglad
5/31/2004 7:54:56 PM
Re: How to count pixels in an image at flash run time. Joy_kittu
5/31/2004 8:35:31 PM
hi,

thanks for your reply, the thing u have suggested will solve my problem upto
40% again the prob araises when we want to count the pixels for irrugular
shapes.. let us say curvy line.. i want only to calculate that line portion of
the image.. we should not consider other than the line area... is it possible..

thanks in advance...

bye
Re: How to count pixels in an image at flash run time. magodellaneve
5/31/2004 9:40:50 PM
You can try in this way , when image is loaded launch this script :

x = yourclip._x;
y = yourclip._y;
h = yourclip._height;
l = yourclip._width;
area = 0;
for (pixel_y=y; pixel_y<(y+h); pixel_y++) {
for (pixel_x=x; pixel_x<(x+l); pixel_x++) {
//trace(this.hitTest(pixel_y, pixel_x, true));
if (this.hitTest(pixel_y, pixel_x, true)) {
area = area+1;
}
}
}
trace("AREA="+area);

area is the total number of pixel.
Re: How to count pixels in an image at flash run time. magodellaneve
5/31/2004 10:03:22 PM
Re: How to count pixels in an image at flash run time. kglad
5/31/2004 11:39:36 PM
Re: How to count pixels in an image at flash run time. henri
6/1/2004 12:52:17 AM
I think it is not pertinent, as even in an irregular image (bitmap mode) the
total pixels will be that of the rectangle encompassing the image. In other
word the transparent part is considered as a color. If you are talking about
a vector drwawing, the amountof pixels is less relevant as the image is
created on display only. Inside the memory the vector image is stored as a
range of ... vectors and x,y points.

Henri


[quoted text, click to view]

AddThis Social Bookmark Button