Flash :: Trim Away The Transparent Pixels Of The Image?
Nov 16, 2011
I have a Flash fla file that contains a whole lot of images. The majority of each image is composed of transparent pixels with a visual object in there somewhere. Each image at the moment is at {x:0, y:0}.I want to trim away the transparent pixels of the image down to a minimum bounding box, but keep the object at the same global position. This requires shifting the trimmed image to the global position of the object in the untrimmed image.This is not so much a problem, but the fact that the images are all contained in a fla is the problem. The options I see at the moment are:
investigate JSFL, the Bitmap object has a getPixels, this in combination with a selection and delete operation could work save the fla to xfl and enumerate the images and associated xml with something like Ruby + image processing lib
Questions: Does anyone know upfront if this operation is possible in JSFL? Have anyone done much automated processing of xfl files? Is there an off the shelf image processor that can perform this trimming operation?
View 3 Replies
Similar Posts:
Feb 23, 2009
Is there a way to trim a bitmap so that the width and height are not effected by transparent pixels?
View 5 Replies
Oct 22, 2010
I've managed to get myself stuck in a situation where a database full of images ( transparent images of various products ) needs to be placed on the stage, all of which need to be aligned the same by the products height. My problem is that the png's of products are 'floating' and I have no control of where about's in the png it will sit ( could be tight at the top and loads of room at the bottom, vice versa)
Does anyone know an existing way to find out the png's 'true' height ( width is an extra ). I've thought about looping through the bitmap data and checking but wondered if anyone has invented this wheel already?
View 4 Replies
Feb 27, 2010
I am creating a map in flash cs4 with all the countries on it. I used photoshop for creating the map and separated countries. Now I imported all pngs in Flash and I want to give Mouse CLICK event and Mouse Hover on all pngs, but as the transparent pixels are overlapping the other states, it is getting difficult. So, I converted all pngs in movieclips and now then I broke up pngs. Now I want to delete all pixels having alpha 0 using eraser tool, as per the borders. And I have to do it manually for individual countries. So is there a way to remove transparent pixels from the bitmap data?
View 2 Replies
Mar 17, 2011
I have a BitmapData object with transparency (the sourceBitmapData parameter). Every time I use copyPixels() to copy it onto another BitmapData object the transparent pixels replace whatever is beneath them. I would like the copyPixels() function to simply ignore these fully transparent pixels (0x00) and NOT copy themBTW, I've tried setting the alphaMerge to true but that doesn't solve the issue - the whole source object just goes black and ignores ALL transparency.EDIT:
Here are the code snippets;
var b:UIComponent = new UIComponent();
b.graphics.beginFill(color, opacity);
[code].....
View 3 Replies
Oct 2, 2011
I have a Sprite that contains opaque objects surrounded by transparent pixels. I also have a Rectangle that represents a part of the Sprite that I want to render using BitmapData.draw(). The problem is that the Rectangle that I obtained also contains transparent parts. How can I narrow the Rectangle to only include the opaque parts and ignore the transparent surroundings?
kapep's answer is just what I want to do, but the problem is that the source is a Sprite, not a BitmapData object, and I don't have getColorBoundsRect() on a Sprite.
View 2 Replies
Sep 13, 2009
I want to create a SimpleButton that has some PNG/GIF graphics as the down/up states. Part of the pixels are transparent and I don't want them to be clickable, is that doable?
View 9 Replies
Aug 5, 2011
I am using ColorMatixFilter on an Image in Flex. I am really close to getting want I need out of the filter.Basically any PNG file the user uploads I want all pixels that are not transparent to be colored black. I have a function that sets the "brightness" already so I just through a really large negative number at it like -1000 and it does the job but the problem is any pixels that have any alpha to them, say 0.9 or below all end up being white when I encode my PNG file on the server later.
[Code]...
I would like all pixels to be solid black unless the pixel is completely transparent and not sure how to tweak the values to get that out of it.
View 1 Replies
Jan 28, 2009
Iv created an app in work which needs a rubber. I basicly have a tool to draw line (paint/pencil). This draws over the entire stage area, including over buttons and interactive mc's. Once i draw the line i then want to be able to erase bit of it.
To this end iv made an eraser tool, which works well. I turn the line into a bitmap, then turn the eraser line into a bitmap and use BlendMode.ERASE to erase one from the other. My problem is, because when creating the bitmatdata i have to create a rectangular shape, the area created then means that i cant access any of the buttons underneath.
here is my code:
ActionScript Code:
//line array is an area of all the line objects which are currently live on stage.
for(var i=0; i<lineAr.length; i++){
[code]....
The way i see it i need to remove the transparent pixels from delBitMap once the erase has been done.
View 2 Replies
Jun 17, 2009
Is there anyway I can do a hittest that ignores transparent pixels? If so how would I do it.
View 2 Replies
Aug 4, 2009
I'm trying to use copypixel to copy an image and paste it onto an existing bitmap. However, the image I'm trying to copy has transparent pixels so when CopyPixel's pastes the image onto my existing bitmap, the pixels already on the image is replaced by the transparent pixels from my image.
How can I make it so CopyPixel will only paste all pixels besides the transparent ones onto my bitmap?
View 2 Replies
May 13, 2010
I have a list of images, and without scanning through each pixel in each image, I want to find out if the image contains transparency (at least one non-opaque pixel).Is there a shortcut to do this (like a property of bitmapData object) rather than looping through the pixels?
View 5 Replies
Jul 29, 2008
i want to make all white pixels in my Bitmap transparent. i found the treshold-method and try to use it:
Code:
var pt:Point = new Point(0, 0);
var rect:Rectangle = new Rectangle(0, 0, 2000, 2000);
var threshold:uint = 0x00FFFFFF; // all white Pixels
[Code]....
View 3 Replies
Oct 28, 2010
im trying to draw opaque pixels on a transparent bitmapdata background
heres the ex:
ActionScript Code:
//TRANSPARENT BACKGROUND
var _pixelColor:uint = 0x9998002E;
var _bmpd:BitmapData = new BitmapData(4, 7, true, 0x00333333);
[Code].....
This example paints 2 arrows, the first is using the transparent background, and the second is using an opaque background on the BitmapData.
What I'm trying to achieve is to paint the pixels of the arrow completely opaque on the transparent background. But as you can see, the pixel is at 99% of its opacity (var _pixelColor:uint = 0x9998002E) How can I paint 100% opaque pixels on a transparent BitmapData "canvas"?
View 1 Replies
May 2, 2009
I am trying to use the bitmapData.setPixels method to set certain pixels in the bitmap transparent.But no matter what I do, it always seems to set the pixel(s) black (non-transparent).Here is my code:
[AS]
bmpd = new ImageFromLibrary(0, 0);
bmpd.setPixel(0, 0, 0x00000000);
[/AS]
why its not setting the pixel(s) transparent?
View 4 Replies
Sep 14, 2011
I am trying to load an image of size 6000 × 8192 pixels which cleary exceeds flash platform limitation for an image.
I am trying which doesn't seem to work.
I have had search around the internet and found few components like BitmapDataUnlimited, and BigAssCanvas but I amn't sure if I can use them for displaying a remote image as none of them seem to have a working implemented example and just the class itself.
View 1 Replies
Dec 13, 2007
Some images I load dynamically are too big so I would like to scale them to fit the stage.
[Code]...
this returns 0. Why does it return 0 when the image loaded is obviously much larger then 0 pixels. How do I change the width and height of imgCont to a specified dimension.
View 1 Replies
Jan 7, 2010
I am using flv player in my application and i want to trim my displaying video in run time.Is it possible in flash or let me know if you have any solution for this problem.
View 2 Replies
Apr 19, 2010
I've created a short text (a word) in photoshop with the blending options I prefer and now it's all done I would like to paste it into my flash project. The problem is I can't get the text to be transparent in the flash, I always see the white background which is not very nice since the background on which the text will show is actually a picture. How to make this text transparent? In photoshop I started a new transparent project. Copying from a .GIF file also doesn't work...
View 3 Replies
Aug 26, 2011
I imported and .png (bitmap) and converted it to symbol however when I place it on stage and look at it the corners (marker with red, edit: basically all the corners are somewhat incorrect) appear somewhat ugly, however when I zoom in to 200% I see that everything is correct. I'm also sure that when importing the .png image the pixels were correct. Why is it so and how to fix it?
View 2 Replies
Apr 11, 2009
Is there a way to make the transparent area from an png image not to register when I add with a mouse event to that image? What is happening is the rectangle around the symbol is effected by the mouse event.
View 2 Replies
Feb 15, 2010
I actually try to do the following: I have loaded an external image in a bitmapdata object and create a bitmap from it which i attach it to a sprite/MovieClip in order to have mouse events on it. Now under the previous logic i loaded two images (let's say circles) of the same size one that has a particular color and is covered by its black foreground circle. When i press left mouse button and hold it down i want while the mouse is moved to erase the foreground circle's pixels and so the background image starting to appear.[code]...
View 1 Replies
Jan 17, 2010
I thought this was going to be easy, and hopefully for someone it is, but I'm having a tough time so thought I'd ask here...
I have an image - say 50 x 30 - 1500 pixels.
I need to scale it so that it keeps it proportion, and takes n pixels - say 20 for example.
View 5 Replies
Mar 24, 2012
so instead of the pixels being dissolved, the pixels being added? :
ActionScript Code:
var Anim:TransitionManager = new TransitionManager(blackbox);
Anim.startTransition({type:PixelDissolve, direction:Transition.OUT, duration:1, easing:None.easeOut, xSections:35, ySections:35});
basically what i would like is the end point to be the start point and the start point the end point.
View 2 Replies
Jun 17, 2009
I have a swf file that loads into my main movie, and within that swf there is a masked image that i would like to scale using zoom in and out buttons and also by using a slider bar.However i cant find any tutorials that will allow me to combine the two.I have used the following code for the buttons. Which seems to work ok but i would like it to be a little smoother. (using speed or some sort of easing??)
ActionScript Code:
zoomPlus.onRelease = function(zoomIn) {
if (test_shirt.shirt._xscale == 400 && test_shirt.shirt._yscale == 400) {[code]....
but for this code it keeps shrinking my initial object down to 10 pixels by 10 pixels..
View 0 Replies
Nov 18, 2009
I have a movie clip called column1_mc. when I click a button I need to move the movie clip in incremental moves consisting of 30 pixels.
column1_mc._y = 30;
Does not work because that is giving a _y coordinate.For example.I need to make the movie clip jump to _y 300 but make 10x30 pixel incremental jumps. Moving 10 times 30 pixel jumps.
View 1 Replies
Feb 2, 2010
I need to trim away away all the extra spaces that a users types into my input text field. I know that there are a few ways possible, but i'm not sure how to go about doing it.
View 5 Replies
Aug 9, 2010
Any way to copy the pixels or handle the image from URL "[URL]" in Flash? It will work fine in FLASH IDE but when I look this in browser, then it crashed. I know that its crossdomain Issue. I always get childAllowParent=false after loading. It always crashed when I want to get event.target.content or
addMC.getChildByName(mcName);
I am loading this image from Google Image search API in Flash CS3 Professional and AS3.
View 3 Replies
Jul 26, 2011
I'm trying to copy pixels from a loaded image. This code generates no errors but there is a missing link between the bitmapData object and the loaded image.
ActionScript Code:
package
{
[code]....
View 4 Replies
Feb 17, 2010
Is it possible to detect (dynamically) the white pixels of an image and delete them? Actually i have some images that i load on stage but they are square without the actual image be a square sized. So i want to make the hit area exactly the shape of the image and not the whit border they have.
View 2 Replies