Flex :: Get The BitmapData From A Local Image?

Jun 21, 2011

The image is already held locally on the client PC and it is an Air application. The image is not embedded, it is in the Application Storage directory.

I have seen this question: How can i get a BitmapData object out of a File object from a local jpeg file in AIR? but it uses URLRequest which I don't think is what I need because the file is local.

View 2 Replies


Similar Posts:


Flex :: Copy BitmapData From Mx:Image?

Sep 3, 2010

How can I copy or duplicate the bitmapdata from a mx:image component?

I need to display the same image in multiple screens of my application and don't want to have to download the image multiple times.

I could just use a urlrequest to download the image as a bitmap and copy that but I like the way you can can just set the source of the image component.

View 2 Replies

AS3 :: Can't Get The Bitmapdata From Dropped Image In Flex Air

Apr 4, 2011

When I drop an image onto my canvas I can get the nativePath to the image but not the bitmapdata wich is the one I need.

In debug mode when I look into the file properties the data is set to NULL.

In my code file.data doesn't give me anything.

protected function creationCompleteHandler(event:FlexEvent):void
{
this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER,onDragIn);

[Code]....

View 1 Replies

Flex :: Bitmapdata - Save Image With Higher Dpi?

Jun 14, 2011

In Flex, I am using graphics.codec.JPEGEncoder to save image files that are edited inside application (normal manipulations like brightness etc.) I am able to save files perfectly. What I want to know is that is there any way I can save the image with a better dpi? Say, for instance the image that is loaded and manipulated was originally of 72dpi, now can I save it with a dpi of 150 or 300 ? If so, how to do it.

Doesn't have to be using the JPEGEncoder, if there's any way to do it at all, like using any library etc, I am okay with it.

Note: If it matters, I am using Bitmapdata to store the image and manipulations and saving the image with JPEGEncoder by supplying it's data as bytearray like below.

var imageBytes:ByteArray = encoder.encode(myBitmapData);

View 1 Replies

Flash :: Converting A SVG Image Into Bitmapdata In Flex 4

Oct 25, 2011

I am working on a flex project, where I have to load a couple of SVG files and compare their pixels. To compare the pixels, I like to convert them into a byte array (BitMapData). I am able to create a bitmap data for a PNG image, but not for a SVG image.

View 1 Replies

Actionscript 3 :: Flex : Translate Embed Image Into BitmapData?

Jun 20, 2011

fast methood to turn an Embed Image into BitmapData.

View 2 Replies

Flex :: Convert A FXG Image To Bitmapdata Of Fixed Size

Oct 10, 2011

I need to do this conversion so that I can determin the drag drop colour a puck lands on.

possibly involving:

ImageSnapshot
BitmapData

This would be in Flex 4

View 1 Replies

ActionScript 2.0 :: Upload BitmapData To (local) Server?

Mar 19, 2009

I have a webcam script that takes screenshot when you click the snapshot button. Now I would like people to have another button to upload their photo on the server. How can this be done?

import flash.display.BitmapData;
mycam = Camera.get();
vid.attachVideo(mycam);// vid is videoobject on stage
bitmapData = new BitmapData(160, 120, true, 0);

[Code].....

View 1 Replies

Actionscript 2.0 :: BitmapData And Local Vs Remote Images

Feb 27, 2012

I am creating an interactive post-it for an upcoming event that allows for us to tap into a sql database and post tweets, survey answers and images. We've already tapped into the Twitter API and the survey, so those are A-OK.The problem lies within loading the images from a location other than the local interactive board's server.If the image itself is locally hosted, it loads just fine.If the image is hosted elsewhere, the image will not load, even though I have a trace on the URL of said image.I'm loading all tweets, surveys and images through an XML load and all the data is loading properly.I AM loading the image through a smoothing filter so that when the "post-its" are slightly rotated, they are not jagged. Here is THAT code:[code]

This is a two part script where the bulk loads in the image and places it into an empty movieclip, then adds the smoothing filter. The second part is a resizer that automatically resizes the image and keeps the aspect ratio.When I test the flash piece (not embedded in HTML) the thing works 100%.As soon as I put the swf into an html and view it on a web page, the remote images will not load.I'm a bit stumped on why this is, could this be a firewall or security issue? Because I work in a high security firewall environment.

View 1 Replies

Actionscript 3 :: Displaying Huge - Scrollable Graphics In Flex - Part 2: BitmapData Into An Image?

Aug 6, 2009

I have the code to copy parts of a huge loaded BitmapData to a target BitmapData that is just the size that I can display. I think I have set the scroll bars of an enclosing Canvas to show the size of the larger image and allow the user to scroll. Now I need to put the selected pixels on the screen. When I try to add a Bitmap component as a child of the Canvas, it get an error because Bitmap is not a UIComponent. What's the best way to put the target BitmapData into an Image component?

View 1 Replies

Flex :: Saving And Loading Image To Local SQLite BLOB ?

Sep 8, 2011

I need to be able to save and load images into an SQLite database using Flex 4.5 for a mobile application. The use case is this:

Inside the view there is a spark Image object with a URL as a source

When user clicks button, the Image is saved to an SQLite db inside a BLOB field.

In a separate Image, the source is set to the ByteArray stored in the db.

The biggest question so far is this: where do I get the ByteArray for a loaded Image? I've tried debugging and inspecting Image, BitmapImage, and BitMapData but there's no sign of the byte array.... perhaps it's inside the ContentLoader? But that's null unless I enable caching.

I've done some research and there are no complete examples for how to handle this. I've written a simple View that anyone can copy and paste into a new project. It will compile without errors and can be used for testing. I will update this code as I get the answers I need so that anyone can have a fully working example of this workflow.The only caveat: I used a synchronous connection to the DB to avoid complicating the code with event handlers, I wanted to keep it as simple as possible.I will only mark this question as answered once it is fully functioning both ways.

UPDATE SEPT. 09 2011: The code below is now fully functioning in both directions (save and load). Here are some of the things I've learned: It turns out that the ByteArray of a spark Image can be found inside the LoaderInfo of the image itself. Like this:

image.loaderInfo.bytes

However, trying to set this ByteArray as the source of another image ( image2.source = image1.loaderInfo.bytes) results in this security error: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.Which is too bad because it would save so much time and processing power.the workaround is to encode the ByteArray using either a JPEGEncoder or a PNGEncoder. I used the JPEGEncoder which produces much smaller files. Here's how:

var encoder:JPEGEncoder = new JPEGEncoder(75);
var imageByteArray:ByteArray = encoder.encode(imageToSave.bitmapData);

Now the problem is saving these bytes to the DB. Saving them as they are now will not work once we read them out, I'm not sure why. So the solution is to encode them into a base64 string like this:

var baseEncoder:Base64Encoder = new Base64Encoder();
baseEncoder.encodeBytes(imageByteArray);
var encodedBytes:String = baseEncoder.toString();

So now just save that string into the BLOB field and later read it out. However, you have to decode it from a base64 string to a ByteArray like this:

var encodedBytes:String = result.data[0].imagedata;
var baseDecoder:Base64Decoder = new Base64Decoder();
baseDecoder.decode(encodedBytes);
var byteArray:ByteArray = baseDecoder.toByteArray();

Now assign the bytearray as the source of your image and you're done. Simple right?if you find any optimizations or alternative ways to do this.I will respond and keep this code updated if need be.

View 2 Replies

Flex :: Upload Local User Image And Overlay Onto Flash Video/animation?

Sep 2, 2011

I want to create a custom video like the videos on jibjab, i.e allow a user to upload an image of their face and superimpose this onto a video of a character's face.

View 1 Replies

Professional :: BitmapData / GetPixel Mystery - Works Perfectly On Local, Failing When Uploaded?

Dec 13, 2010

I'm working with a video in Flash where I am capturing each frame and testing the color of a single pixel. I'm using it to determine when a white/transparent background changes to be a color. The following AS2 code works flawlessly when I preview it in Flash and on my desktop in the browser (the direct SWF and placed inside HTML using SWFObject) but as soon as I upload it to my server it fails and produces "FFFFFF" continuously regardless.

this.onEnterFrame = function()[code]..........

There is no difference in the files; they are both pulling from the same video source (hosted on an Flash FLV server).The only difference is one set of files is hosted on my local computer and the other is hosted on my web server.

View 2 Replies

Flex :: AddChild A BitmapData Or Draw A BitmapData To Screen?

Jul 15, 2009

I'm currently working on a flash game and I need to know how to addChild a BitmapData or draw a BitmapData to screen. If I can't than how can I give a DisplayObject my BitmapData?

View 2 Replies

Javascript :: Access An Local Image (not In App Workspace) From A Local HTML File (in App Workspace)

Mar 12, 2011

I have a HTML box and load a local html file from the project. In this HTML file I use jquery and I want to load an image from my user directory. I see the image from my user directory but jquery doesn't works. I get this error:

[Code]...

But if I load an image from the app workspace, everything works fine (I see the image and Jquery works). Is this a policy problem? The error says that is a "null object reference" problem, but this can't be true...

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

Flash - Convert A Local Image File To A Dataurl For Use In Image Src?

Feb 23, 2011

I am building a flash widget for uploading files, but I want to display the thumbnail with html/js, once I have the file loaded via Browse into flash and have access to the raw data, is there a way to convert that to a base64 encoded dataURL so I can send that back out to JS to create a thumbnail like ?

View 1 Replies

ActionScript 3.0 :: Error #2148: Only Local-with-filesystem And Trusted Local SWF Files May Access Local Resources

Jul 4, 2010

I'm trying to load a local xml file:

xmlLoader.load(new URLRequest("../xml/xmlData.xml"));

But I'm getting this security sandbox violation:

#2148: Only local-with-filesystem and trusted local SWF files may access local resources.

I don't get this error when I embed the XML file directly with the EMBED metadata tag.

View 3 Replies

AS3 :: Flash - BitmapData Of A Masked Image?

Dec 14, 2009

I am trying to take a snapshot of the masked region of an image... so, I load my image then perform the following functions:

private function manageLoadedImage(e:Event):void
{
_bitdata = e.currentTarget.content; // get the bitmap
_bithold.addChild( _bitdata ); // add the bitmap to a sprite on the stage

[Code]....

I have a movie, inside that movie I have a thumbnail editor name ThumbEdit.

ThumbEdit has a movieclip on its stage called "holder1". In the document class of ThumbEdit I create a sprite "_bithold" and place it on the stage at holder1.x and holder1.y. When the image loads, I add the image to _bithold and then mask _bithold with a shape. So, I want to grab a snapshot of the masked region of _bithold but I'm not sure how I should go about doing that.

View 3 Replies

ActionScript 3.0 :: Importing Image To BitmapData?

Oct 5, 2010

This should be a sample question ,, all i want is to import an image from my computer to a bitmapData , knowing that my image is png .. ?

View 6 Replies

ActionScript 2.0 :: Image File To BitmapData?

May 1, 2006

Im doing this game as final project for graduation and I want all imagery available and dynamicly loadable from a directory without a need to have it all imported into a library.

So is there a way to load external image and convert it to BitmapData or get its content at pixel level?

[edit]Cause I dont see any. If I load it with loadMovie, it becomes content of a MC and I dont know af any functionality to work with a MC as with a bitmap and any other loading method is not know to me too.[/edit]

View 5 Replies

ActionScript 3.0 :: Break Image Apart Using BitMapData?

Mar 28, 2011

I've read some stuff here and there, but I dont really understand how this would work. For example, I have an image of 800x500 and want to break this apart in 40 pieces (100x100), how would I do this using the bitMapData and (probably) draw Rectangles which will hold the pieces?

View 10 Replies

ActionScript 3.0 :: Get Scaled Copy Of BitmapData Of An Image?

Apr 6, 2011

For the class  spark.components.Image
 
I can access the bitmapData object  (readonly) (unscaled). I know the scaling factors of the Image.
 
How  can I get a scaled version of the bitmapData?

View 3 Replies

ActionScript 3.0 :: Change A Color To Another In A BitmapData Image?

Nov 10, 2011

Let's say you have an image of a cartoon human that is wearing a blue jacket with white sleeves, blue shoes, and grey pants. Brown hair and biege skin tone.(My project actually has 1300 of these images - 325 are blue cloths, 325 are red cloths, 325 are green cloths, and 325 are purple cloths)I am having a major problem with file size and memory usage due to all the images, so I have been asked to see if there was a way I could programmatically change the clothing color... this way we can use any color we want, and only have 325 base images.I have been trying to play with color matrix filter and color transform, but I can't seem to get the hang of itIs there a way I can extract only the "blue" colors from the image and do a hue shift on it to the color that I want it to be without effecting the non-blue colors

View 3 Replies

Actionscript :: Image From Flash BitmapData To PHP To Webpage

Apr 6, 2011

I'm trying to display an image exported from a flash BitmapData in a basic webpage.[code]the above code does NOT work, I can't find a way to display the image embedded in the webpage.

View 2 Replies

BitmapData - Zoom In Image On Mouse Scroll

Jan 9, 2012

I need to be able to zoom in on my image, but I cant get it to work properly. I've got an Image showing my content, and it get it's content from a BitmapData. The BitmapData is full-res, which is 2880x1620, and the Image is scaling to fit my window. The SmoothImage is the same as Image, but with smoothing added.
<me:SmoothImage id="imageFull" visible="false" width="100%" height="100%" />

How would I go about zooming this image when I scroll my mouse? This is the code I have, and it does change the scaling factor. But since it's set to fit my view, nothing happens...
public function videoBufferWheel(event:MouseEvent):void{
myZoom += (event.delta/10);
if(myZoom >=1){
imageFull.scaleX = myZoom;
imageFull.scaleY = myZoom;
}else{
myZoom = 1;
}}

View 1 Replies

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

ActionScript 2.0 :: Load External Image Into Flash Like BitmapData?

Jul 20, 2009

I'm trying to load external image into Flash like BitmapData. Problem is, whan I load image into movieClip and than I want to convert it by using draw(), in bitmapData variable is an old statement of mc (before loadClip instruction). But from the logic of source code is imposibe.

source code:

import flash.display.*;
import flash.geom.*;[code]..............

View 0 Replies

ActionScript 3.0 :: Bitmapdata With Vector Graphic And Image Data

May 6, 2010

I have displayobject with vector and image data And I am trying to scale it in order to get big jpeg out of it with JPGEncoder.The thing is that once I am resample it using the Bitmap class (Matrix) and with draw method it's getting pixelated.How can I take a container with vector graphic and bitmap image and rescale it to bitmapdata without getting things pixled.This is the displayobject:The image in the center is high resolution image which I resize and all the other elements are vector graphic.Since the image is high resolution and all the other elements are vectors if I just call the scaleX property of the displayobkect it increase the contenier size and it all looks very good. But if I want to take a bitmap data out of it it's look terrible, The fonts getting pixelated and even the photo.I will like to know it there is a way to do it without getting things pixelated.

View 0 Replies

ActionScript 2.0 :: Loading Image Into MovieClip Then Into BitmapData (Renamed)

Nov 6, 2006

I am trying to load an image into a movieclip and then draw the contents of the movieclip to a bitmapData object.

Below is some sample code.
target.jpg_mc.loadMovie(url);
target.createEmptyMovieClip("loader_mc", 100);
target.loader_mc.bmc = target.jpg_mc; // movieclip where to load original image
target.loader_mc.tmc = target.bmp_mc; // movieclip with smoothed image
target.loader_mc.onEnterFrame = function(){
[Code] .....

For some reason it always draws a white box rather than the image. Has anyone ever seen this happen with the bitmapData class?

View 4 Replies







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