ActionScript 3.0 :: Capturing An Image BitMapData In ByteArray

Dec 19, 2010

I'm trying to grab the BitMapData from an Image, convert it to JPG, and send it to a server where it will be written to a file. It "looks" like it works, the resulting .jpg is the right size and displays in an image viewer, but there is no picture... just an off-white background. Here's a code snippet:

imgTemp.addEventListener(FlexEvent.UPDATE_COMPLETE , imageLoadedHandler);
...
private function imageLoadedHandler(event:Event):void {
if (imgTemp.width == 0) return;

[Code].....

Then send "ba" to the server where it's written as a .jpg.

The data "looks" right when I receive it on the server, correct length, bits look the same.

View 7 Replies


Similar Posts:


ActionScript 3.0 :: Capturing BitmapData While In FullScreen

Jun 25, 2009

I am trying to do an image capture while in full screen, however the full image area is only partially captured, or the coordinates are off (see images below). The document size is 100x700, and the stage is set not to scale / aligned to bottom.I've been able to capture the right size, however it always seems to capturing the image from the wrong start x,y position. There is some elements out of bounds but I am just trying to clip them depending on the current stage width and height. In the source files you will see a few of my attempts commented off (below/attached).Fullscreen Capture :Normal Capture :

CODE :
import com.adobe.images.JPGEncoder;
///---------- [ Set Variables ] --------///

[code].....

View 14 Replies

ActionScript 3.0 :: Capturing BitmapData While In FullScreen?

Jun 23, 2009

I am trying to do an image capture while in full screen, however the full image area is only partially captured, or the coordinates are off. The document size is 100x700, and the stage is aligned to bottom. I've been able to capture the right size, however it always seems to capturing the image from the wrong start x,y position. There is some elements out of bound but I am just trying to clip them.In the source files you will see a few of my attempts commented off. Is anyone willing to help me troubleshoot this?

Here is a live link :

[URL]

If you right click you'll see the save as wallpaper option. It works properly while in normal display but everything gets offset in full screen mode.

View 3 Replies

ActionScript 3.0 :: Capturing BitmapData Offset - Click From The Centre Of The Colorwheel Down Get The BitmapPixel Value

Aug 12, 2009

However I have created a colorwheel and positioned the container it resides in. They using a simple click listener

[Code]....

the issue is if I click from the centre of the colorwheel down I get the bitmapPixel value, but the other 3/4of the item returns 0.

View 6 Replies

Actionscript 3 :: BitmapData To ByteArray?

Jul 28, 2010

I am trying to serialize a Bitmap to store in an XML file. My plan is to turn the BitmapData into a byteArray, but I haven't been able to fine an example of this.

View 1 Replies

ActionScript 3.0 :: ByteArray To BitmapData Conversion?

Jul 5, 2007

i want to do some cryptographic routines in my flash. I've encrypted .jpg files on my server, so I can't use simple Loader class, to download that data as Bitmap. I'm thinking to:

1) download it with URLLoader as BINARY data in ByteArray class.

2) decrypt the data

3) convert to BitmapData. (..., is this possible ?

how could I do image crypting in fl.

View 14 Replies

ActionScript 3.0 :: ByteArray To BitmapData In 1 Function?

Jan 9, 2010

I need a function to change an ByteArray to BitmapData in 1 function:

makeBitmapData(bytes:ByteArray):BitmapData

Is this possible? Cause all I can find about this is first put the bytes in a loader. add listener to the complete event and then call a function that make the bitmap/bitmapdata. can this also be done in 1 function?

View 5 Replies

ActionScript 3.0 :: PNG To ByteArray To Multiple BitmapData Objects?

Sep 17, 2010

is there anything that will take a very large png (even larger then the total pixel limit of BitmapData) and load in the png as raw bytes into a bytearray and then take that array and grab only portions of the image to be able to generate a grid of usable bitmaps to render the very large png..I got to the point where I was able to get the png as a bytearray but from there I don't know how to grab a portion of the bytearray and attempt to load the partial bytes in a loader via loadBytes()..basically I think I need a decoder to decode the partial bytes to a bitmapdata.

View 2 Replies

Flex :: EOF Error Encountered While Converting Bytearray To Bitmapdata

Mar 18, 2010

I am using [code]...

In the 4th line in the code above i am getting "Error: Error #2030: End of file was encountered." I checked the length of the pixels object which is 4 times the width*height of the rect object. Given that setPixels() functions reads unsigned int from bytearray and sets that value to pixels, I think it should work.

But I have no clue why this wont work. The pixels object is filled after RLE decoding of the data which i get from a server.

Is there any work around or any other method which I could try to use. The loader class wont work as the data that I get from the server is not in any of the recognized format.

View 2 Replies

ActionScript 3.0 :: Rendering A BitmapData From Webcam And Sending The Rendered ByteArray?

Sep 12, 2009

i am rendering a BitmapData from my webcam and sending the rendered ByteArray(i cant compress using ZLIB because its not running on AIR) file as binary to a server side. problem is each JPEG picture is around 40kb and it needs to be compressed a bit.now i am not talking about resizing the image, just making the file size smaller. anyone know how to do this?

View 2 Replies

Actionscript 3 :: Use The Method SetPixels(rectangle, ByteArray) Of BitmapData In Adobe Flex

Feb 3, 2011

Error #2030: End of file was encountered.

This method is not working

I am using it like this

var ba:ByteArray = new ByteArray();
ba = bmd.getPixels(bmd.rect);
bmd.setPixels(srcRect, ba);
bm.bitmapData = bmd;
img.source = bm;

View 1 Replies

Flex :: Capturing Key Events In A Mx:Image?

May 6, 2010

I'm trying to capture key events in a mx:Image and I can't get it to work.

<?xml version="1.0" encoding="utf-8" ?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" />
<mx:Canvas width="100%" height="100%">

[code]....

When I press a key when the mouse is over the image I expect the label text to change to "Something", but nothing happens. I've done all sorts of combination of enabled and putting the keyDown on the canvas and the label as well.

View 2 Replies

ActionScript 3.0 :: Capturing Overlapping Area On Image

Mar 9, 2011

I need to develop a flash too that can capture a 800 X 600 image from a VERY larger image. The user will click on a spot on the image and this spot where he clicks will be the centre point of the new image that will be generated. The problem is this, when his centre point is less than 400px from e.g. the left, I need to capture the overlapping area on the right hand side of the image.

View 3 Replies

ActionScript 3.0 :: Capturing Image From Webcam And Loading To Flash?

May 12, 2009

I'm trying to have a webcam option in my flash that would allows the user (if they have a webcam) to take a picture of themselves and show this picture in flash.So far I've only been able to get the camera part working, that is the webcam feed is showing. How do I go about capturing the image when a user presses the button and then load that up in the flash?

Code:
import flash.display.BitmapData;
import flash.geom.Matrix;

[code].....

View 2 Replies

ActionScript 3.0 :: Taking Bitmapdata Of An Image Scaled Down With Overlay Objects On The Image?

Apr 26, 2009

hi guys, i got this image i scaled down by .5. The user is then allowed to add objects to the image such as flowers that are sprites in the library. So basically, a jpeg that is 800 x 800 is down to 400 x 400 on the stage and the user is able to add objects to overlay the image.

i want to save the image with the flowers and objects back to its 800 x 800, how do i redraw this image using bitmapdata properly?

View 2 Replies

Flex :: Core ByteArray Image?

Sep 6, 2009

var myFile:File = new File("./test.jpg");
var myFileStream1:FileStream = new FileStream();
myFileStream1.open(myFile, FileMode.READ);[code].....

now how can i add byte variable to the canvas ? for example

var canvas:Canvas = new Canvas();
canvas.addChild(byte);

is it possible to add ByteArray to the canvas?

View 2 Replies

Ruby :: Image/ByteArray To SVG Conversion?

Nov 12, 2009

I am wondering if it is possible to get a url to some image on google, say a square (jpg/png/gif), and process it into an SVG. Is this possible?

Right now I'm getting ByteArray data in Actionscript by making a URLRequest('image/on/google'), with dataFormat="binary". I don't think Actionscript could handle/do it, but maybe it could. I'm also good with Ruby, so perhaps is this possible with Ruby?

If so, any sample code/libraries to get started?

I guess another way to ask it is, how do I convert a Bitmap to a set of Vector Paths like Adobe Illustrator does?

View 3 Replies

Actionscript 3 :: Getting Image Size From ByteArray?

Oct 25, 2011

I am wondering if there is any way to determine the width and height of an image that is decoded to a ByteArray.For example in the below, any way to determine these values for data?

var data:ByteArray = new ByteArray();
data = encoded_image.decode(byteArrayData);

View 1 Replies

ActionScript 3.0 :: Get Image Dimension From ByteArray?

Nov 1, 2010

I have problems with the load of an image from a ByteArray, I can't get the image size, witch I need to position the image. Strange thing is that the image is showed to me correctly.

My code is something like this:

ActionScript Code:
var data:ByteArray; //Here are saved the raw image data (JPG, PNG, etc)
...
var img:Loader = new Loader();
img.loadBytes(data);

[Code].....

View 9 Replies

ActionScript 3.0 :: Getting Image Dimensions From The ByteArray

Aug 19, 2011

I have been searching in forums and I couldn't find an answer so I thought maybe I should ask.

I wrote a script that allows user to select a local file, which gets resized if it exceeds the width/height limits I specified, and finally this file gets uploaded to the server.

In documentation it writes the same max sizes for BitmapData and Loader:

Quote:

In AIR 1.5 and Flash Player 10, the maximum size for a loaded image is 8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels. (So, if a loaded image is 8,191 pixels wide, it can only be 2,048 pixels high.) In Flash Player 9 and earlier and AIR 1.1 and earlier, the limitation is 2,880 pixels in height and 2,880 pixels in width.

So what I need is to check the file size (width and height) before I attempt to load the bytes of the file into a loader. I'm limited to the ByteArray that I get by the load of the file via a FileReference instance.

Has anybody seen a source where you can get that data out of a ByteArray prior to loading it into a DisplayObject?

View 1 Replies

ActionScript 3.0 :: ByteArray To Server-side Image

May 22, 2009

I'm capturing an image from an swf and transmitting it as a byteArray to a php file. Everything seems OK in capturing and sending the data but the final image doesn't display and says it is corrupt.

I'm not sure if i need to do something to the byteArray or if there is something wrong on the php side that is causing the error?

I'm using stuff I've found on other posts and haven't tried JPGEncoder yet which is mentioned in some of those posts and examples. I thought it would be simple enough if it was just a getPixels() and wouldn't need JPGEncoder.

here is my AS3 code:

PHP Code:

// owl is mc with image on stage
var bitty:BitmapData = new BitmapData(owl.width, owl.height);
bitty.draw(owl);
//

[Code].....

View 14 Replies

JavaScript :: Upload ByteArray Image On Facebook With SDK

Apr 14, 2012

I'm trying to upload a photo on Facebook using Javascript SDK. In particular I generate a base64 encoded bytearray from my Actionscript3 app, I pass it to Javascript file using ExternalInterface, and from that I decode the bytearray and I try to upload to FB. But it give me this error:
{"error":{"message":"(#324) Requires upload file","type":"OAuthException","code":324}}

I tried to upload an image simply from url, and in that way it goes well! This is my Javascript code:
upPhoto:function(photo) {
var img = F.decode_base64(photo);
FB.api('/me/photos', 'post', {
message:'test',
fileName:'test',
[Code] .....

View 1 Replies

Flex :: Resizing Image From A Decoded ByteArray?

Oct 20, 2009

I am trying to display a bytearray as a resized image. The Image is displaying correctly, but the sizing is off. Let me explain.

First I have the image data encoded so I need to decode the image data

// Instantiate decoder
var decoder:Base64Decoder = new Base64Decoder();
// Decode image data

[Code]....

This works. The image is displayed correctly. However, if I hardcode the image (img) height the resized image is shown correctly, but within a box with the original image's dimensions.

For example, if the original image has a height of 300px and a width of 200px and the img.height property is set to 75; the resized image with height of 75 is shown correctly. But the resized image is shown in the upper left corner of the img container that is still set to a height of 300px and a width of 200px. Why does it do that? And what is the fix?

The best way to illustrate the problem is by placing the image inside a VBox and show the borders of the VBox. From the code block above, if I change the image height and set the image to maintain aspect ratio (which by default is set to true but I add it here for completeness). the problem becomes clear.

// Display image
var img:Image = new Image();
img.height = 75; // Hardcode image height (thumbnail)
img.maintainAspectRatio = true;

[Code].....

View 1 Replies

As3 :: Javascript - Flex - Send A Jpg Image As ByteArray

Jan 10, 2010

How to send a jpg image as ByteArray from as3 to javescript? And how to convert ByteArray to image in javascript?

View 3 Replies

Actionscript 3 :: Get Bytearray Data From Image That Is Under Certain Shape

Oct 19, 2010

How can I get the bytearray data from an image that is under certain shape, for example a circule or square?Let's say I want to modify ONLY the pixel inside this circule, how can I get this Bytearray data?

View 1 Replies

Flash :: Fetch The ByteArray Of The Image With Filter?

Jan 4, 2012

I am using pixel bender's pbj files(as recommended with Flex4) to change the brightness/contrast of a image.So i apply the filters to the image like this:

image.filters = myBitmapFilter;

Now my problem is how to fetch the byteArray of the image with filter applied so that i can send bytearray to my servlet which can save the image with applied effects.

View 1 Replies

ActionScript 3.0 :: Converting Image Into A Readable ByteArray?

Jul 19, 2011

I'm trying to read out some BitMapData into some kind of readable output.

Reason for this is I'd like to trace out the ByteArray and hopefully cut and paste its details into an .as file and then compare it against another BitMapData Object or byteArray that is generated within the app.

Basically I want to compare differences between the two and report back how many pixels or something are different.

It might seem like a strange or approach.

I can create a BitMapData Object, it traces back as [object BitMapData] - so I thought awesome just loop through the Object... But looping through the Object traces nothing at all back out.

So I tried to create a ByteArray and then convert that to a string, but all I get is wierd 'y' chars with two dots on the top of the char.

I've left some code below,

Code:
public function GetAndCompareBitmapData(target:DisplayObject) {
var bd:BitmapData=new BitmapData(target.width,target.height);
trace("bitmapData "+ bd); // trace [object BitMapData]

[Code].....

View 8 Replies

ActionScript 3.0 :: Upload ByteArray As Image To Server?

Mar 7, 2012

I'm trying to snap a bitmap image from within my application, and upload the bytes directly to my server to save as an image. I'm trying to same three separate images, three different sizes. I am able to do it twice, but as soon as it tries to save the third image, it throws a 2176 error...

ActionScript Code:
var url:String = 'myUploadURL';
var request:URLRequest = new URLRequest(url);
request.contentType = 'multipart/form-data';

[Code]....

I've tried a 3rd party class which wraps the byteArray and sends the data. This too works the first two but not the third.

Is it because I start by calling a function on mouseClick, that snaps the first bitmap then uploads, then snaps the second and uploads, then snaps the third and by the time it tries to upload, Flash assumes the function is 'too far away' from the mouseClick, and doesn't think it comes from user interactivity?

View 3 Replies

Actionscript 3 :: Get The Bytearray From The Image And Sound From The Client's Webcam?

Dec 13, 2010

i try to get a bytearray from a webcam. i can get the image of the webcam, copy it to bitmapdata and get the bytearray. but is it possible to get the bytearray from the image and sound from the client's webcam?

View 2 Replies

Flex :: Have Image Bind To Bytearray Rather Than Bitmapasset Or Bitmap

Feb 15, 2011

I have an object that stores the compressed ByteArray version of an image (jpg or png). I want to keep it that way as the bytearray is about 30x smaller than the Bitmap it creates. The problem I run into is when I want to bind an image to this byte array. I can't really bind it to bytearray, because it requires a BitmapAsset as a source. Is there a way I can load a BitmapAsset from a bytearray but still bind to the bytearray when a new image is available?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved