Well, that depends on the picture, but yes, generaly you'd load a jpg, png,
etc, which are compressed formats. For instance, right now I'm seeing a  466
x 468 jpg. Its size is 34 Kb. Bear in mind that the compression ratio varies
depending on the actual image and the compression rate / algorithm applied,
not only the dimensions, but definitely, the dimensions weigh in.

Taking that same image in a "raw" format (i.e. no compression applied),
which is basically what you're doing when you copy the bitmap data into a
ByteArray, you would need 857.352 bytes to store it (466 * 468 * 4). So,
that's 851 Kb agains 34 Kb, a really significant difference.

Probably, a more feasible approach would be encoding the raw pixel data to
jpg or png in the swf, and then send that to the server (after that, it's
just a regular jpg or png, so you can load it as any other image). It'd put
more stress on the swf side, but the download/upload times and server load
would be dramatically cut down.

Check this link, it has a tutorial for doing precisely that.
http://henryjones.us/articles/using-the-as3-jpeg-encoder

Cheers
Juan Pablo Califano


2008/8/14, Omar Fouad <[EMAIL PROTECTED]>:
>
> You mean it is not the same bandwidith taken as when loading the picture
> from a directory in a server?
>
> On Thu, Aug 14, 2008 at 6:59 PM, Juan Pablo Califano <
> [EMAIL PROTECTED]> wrote:
>
> > You can use the getPixels() method of the BitmapData class to get the raw
> > pixel data as a ByteArray. Using setPixels() you can fill a BitmapData
> > object with data from a ByteArray.
> >
> > You can post / retrieve that data from a server using a URLRequest
> object,
> > specifying that you want to use a binary format. The problem of this
> > approach, I think, is that it'd consume a lot of bandwith (unless you
> have
> > really small images). Each pixel takes 4 bytes. In a 400 x 400 image,
> > that's
> > 160000 pixels and so 640000 bytes or 625 Kb.
> >
> > Cheers
> > Juan Pablo Califano
> >
> >
> > 2008/8/14, Omar Fouad <[EMAIL PROTECTED]>:
> > >
> > > Hello all,
> > > I was wondering if I can get the binary data from a bitmap data, and
> send
> > > it
> > > to database (blob) or/and getting the binary data from the database and
> > in
> > > flash reform it to display the bitmap back.
> > >
> > > I've been reading about the ByteArray Class but I am still confused
> > whether
> > > to use it or to use URLStreaming.
> > >
> > >
> > > Thanks.
> > >
> > > --
> > > Omar M. Fouad - Digital Emotions
> > > http://www.omarfouad.net
> > >
> > > This e-mail and any attachment is for authorised use by the intended
> > > recipient(s) only. It may contain proprietary material, confidential
> > > information and/or be subject to legal privilege. It should not be
> > copied,
> > > disclosed to, retained or used by, any other party. If you are not an
> > > intended recipient then please promptly delete this e-mail and any
> > > attachment and all copies and inform the sender. Thank you.
> > > _______________________________________________
> > > Flashcoders mailing list
> > > [email protected]
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > >
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
>
> --
> Omar M. Fouad - Digital Emotions
> http://www.omarfouad.net
>
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be copied,
> disclosed to, retained or used by, any other party. If you are not an
> intended recipient then please promptly delete this e-mail and any
> attachment and all copies and inform the sender. Thank you.
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to