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
Similar Posts:
Sep 28, 2009
I have an AS3 application where I used the bitmapdata with its copypixels to create a cropping effect on the imported image file (JPEG etc), now I am in need for exporting the resulting cropped data to image file suhc as JPEG, TIFF or any other format. I am actually transferring the content of bitmapdata containing the cropped image into movie MovieClip object therefore, exporting from movieclip containing the image data is another option.
View 1 Replies
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Jun 20, 2011
fast methood to turn an Embed Image into BitmapData.
View 2 Replies
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
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
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
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
Apr 8, 2007
I've been looking at one of senocular's rather brilliant source files, specifically the 'rising grid transition', which performs a transition effect by using the bitmapData class. Currently,it loads a variable called 'tempbmp' by using the bitmapData.loadBitmap function:
var tempbmp = flash.display.BitmapData.loadBitmap('hill');
where hill is a jpg in the library with a linkage ID of 'hill'. what i'd like to know is if this process could use an image that is not in the Flash library. Is there a way to load an external image as a bitmapData object?
View 1 Replies
Sep 11, 2007
I'm creating a dynamic image gallery that resizes the images to fit the gallery size, and then smooths them out.I feel like I'm super close to getting it to work perfectly. The image smoothing always works, but the resizing is kind of iffy. The first image displayed will resize just fine, but when you view any others they're all distorted or squashed. What's strange is that I've traced out the resized image dimensions and they're exactly what they should be, but the images are still not resizing correctly.
Here's my code! I only included the parts of it that are really relevant, but let me know if you guys want to see all of it. It's a combination of a few tutorials that I found. I may be able to provide a live example, but it's for work so I'm not sure how the nondisclosure agreement would affect that.
Code:
var thisWidth:Number;
var thisHeight:Number;
var maximumHeight:Number;//height to which movieclip to be resized
[code].....
View 2 Replies
Aug 23, 2011
I have converted a jpg image to Base64 string and saved somewhere. Now How can i convert this Base64 encoded string to bitmapData in flash as2?
View 1 Replies
Nov 3, 2011
its possible to make a glow filter effect around ONLY the image in a loaded transparent PNG?
View 1 Replies
Feb 10, 2009
I made a program in Flex that uses the actionscript 3 drawing api. I am drawing on a Canvas and on every mouseUp event I save the bitmapData in an Image component and clear the the Canvas. That works great, but the problem appears if I want to add a background to the paint that was drawn.
Here are the mxml components:
Code:
<mx:Canvas id="_backgroundColor" width="100%" height="100%" x="0" y="0" />
<mx:Image id="_image" x="0" y="0" mouseEnabled="false" />
<mx:Canvas id="_paper" x="0" y="0" />
And here it is the function I have on the Canvas (_paper) mouseUp
Code:
private function onSaveModifications(evt:PaperEvents):void{
var bmpData:BitmapData = new BitmapData(this._paper.width,this._paper.height,true,0x00FFFFFF);
bmpData.draw(this._paper);
this._image.source = new Bitmap(bmpData);
this._paper.graphics.clear()
}
I want when I set the _background Canvas background color to see it, but I cannot because the Image component(_image) where I save the bitmap is masking it.
This is how I set the background
Code:
this._background.setStyle("backgroundColor",0xff0000)
Do you know how can I make the pixels of the bitmap that weren't drawn to be transparent?
View 2 Replies
Aug 10, 2010
I have a MovieClip that has 2 images inside it:
1) An image from the FLA's library.
2) An image that is loaded dynamically from a server (read from XML file).
When I try to draw the MC into the BitmapData, I get a blank image.
Code:
ActionScript Code:
var destImg:BitmapData = new BitmapData(_root.picW,_root.picH,false);
destImg.draw( mcPicture );
View 1 Replies
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
Nov 26, 2011
Saving a BitmapData to a file? [code]...
View 1 Replies
Jan 31, 2007
I'm using Flash 8, with this code in the first frame:
import flash.display.BitmapData;
rissa._x=Stage.width/2;
rissa._y=Stage.height/2;[code].....
When I publish the file, I'm getting the following error message in the Output panel:
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 7: The class or interface 'BitmapData.loadBitmap' could not be loaded.
var plaid:BitmapData.loadBitmap("plaid");
Total ActionScript Errors: 1 Reported Errors: 1
View 8 Replies