Resize a lot of BItmaps UI?

Hello

I need to add images in the app, but I need to do the photos are recommended for 3 types of phone screen (large, medium, small) and the zoom scale when it starts, but because the images are so many, and they use a lot of memory.

Would be much appreciated if you could provide me some resolutions or indices. Thanks in advance.

Here's what I did today:

...
bgBitmap = Bitmap.getBitmapResource ("bg.png");
bgBitmap = ImageUtility.getResizedBitmap (bgBitmap, newRatio);
...

Here's what I recommend:

-Use only the large of images.

-Use this class by Patchou: http://supportforums.blackberry.com/t5/Java-Development/Resizing-Transparent-Bitmaps/ta-p/703239 it's simple and easy to use (it works for png with transparency bgs).

-Detect the size of the screen of the user using Display.getWidth () and Display.getHeight (), use this information in a custom class to determine how (or if) you will scale of images. In general, you can create ranges using only the height, there are currently 7 different heights with BB devices: 240, 260, 320, 400, 480, 640, 800.

-If you have many, many, many of the images, you can store these images on the scale in the user cache. This would improve performance in the future (so you would only scale images once).

Tags: BlackBerry Developers

Similar Questions

  • What is the best way to display lots of bitmaps

    Hello world

    My application should display a large number of bitmaps on the screen. Oringally, each bitmap is only in one color, but I may have to display bitmaps with textures as well. Now I have more than forty small bitmaps inside the BitmapField on a single screen, and it takes about two seconds to load and make it all. I read the bitmap directly an ARGB table.

    I have made the right choice? Or is there a better way to do it?

    If you complete just one Bitmap with one color, consider the following:

    Bitmap currentBitmap = new Bitmap(width, width); // you are creating squares, aren't you?
    Graphics g = Graphics.create(currentBitmap);
    g.setColor(color.getColor());
    g.fillRect(0, 0, width, width); // now your bitmap is ready - use it!
    

    Should be faster...

  • Resizing of bitmaps with Graphics.drawTexturedPath - bad ratio

    Hello

    I used to resize bitmap images (to have the similar physical size on different phones) in my project with the following code - found in this thread:

    Without creating an encoded image bitmap image resizing

        public static Bitmap resizeBitmap(Bitmap image, int width, int height)
        {
            int imageWidth = image.getWidth();
            int imageHeight = image.getHeight();
    
            // Need an array (for RGB, with the size of original image)
            int rgb[] = new int[imageWidth * imageHeight];
    
            // Get the RGB array of image into "rgb"
            image.getARGB(rgb, 0, imageWidth, 0, 0, imageWidth, imageHeight);
    
            // Call to our function and obtain rgb2
            int rgb2[] = rescaleArray(rgb, imageWidth, imageHeight, width, height);
    
            // Create an image with that RGB array
            Bitmap temp2 = new Bitmap(width, height);
    
            temp2.setARGB(rgb2, 0, width, 0, 0, width, height);
    
            return temp2;
        }
    
        private static int[] rescaleArray(int[] ini, int x, int y, int x2, int y2)
        {
            int out[] = new int[x2*y2];
            for (int yy = 0; yy < y2; yy++)
            {
                int dy = yy * y / y2;
                for (int xx = 0; xx < x2; xx++)
                {
                    int dx = xx * x / x2;
                    out[(x2 * yy) + xx] = ini[(x * dy) + dx];
                }
            }
            return out;
        }
    

    My problem with the code was that it was quite slow - larger images would take almost a second (!) on the older phones (8830) scale.  It did not prevent UI - I have the code running in a separate Thread - but it has considerably delayed showing the image on the screen.

    Recently, I started to experiment with Graphics.drawTexturedPath and I really like this method.  However, I found a weird problem while reducing images.  For example, I need to put a picture of 48 x 48 up to 42 x 42.  The most important parameters for the scale are dux and dvy (of the four walk coordinates vector only these two are zero).  So now my code object looks like this:

    XYRect area = getExtent();
    // ourBgImage is the unscaled Bitmap - our background image
    int imageWidth = ourBgImage.getWidth();
    int imageHeight = ourBgImage.getHeight();
    int[] xPts = {0, 0, area.width - 1, area.width - 1};
    int[] yPts = {0, area.height - 1, area.height - 1, 0};
    int dux = (int) ((((long) imageWidth) << 16) / area.width);
    int dvy = (int) ((((long) imageHeight) << 16) / area.height);
    // Keep aspect ratio and make image fit fully
    dux = dvy = Math.max(dux, dvy);
    g.drawTexturedPath(xPts, yPts, null, null, 0, 0, dux, 0, 0, dvy, ourBgImage);
    

    which is a little shorter and much more fast-work (especially on older phones as 8830).

    However, the image is truncated on the right and down - looks like two pixels are missing on one of these two parties.  This was not the case with the old algorithm. I am specifying all the wrong settings?

    Final nail in the coffin of drawTexturedPath:

    I decided to check how drawTexturedPath resizes checkerboard (mainly the scale down).  And the results are pretty ugly - it seems to use the algorithm "nearest neighbour" without any means.  The project with which I tested it is attached.  Once you have it running, use Alt + move to shrink and Alt + down to stretch.  Observe the results.

    The decision is, of course, to remove this method and resize Bitmaps the old way

  • Solution to resize properly transparent bitmaps

    Hello everyone,

    Recently, I tried to use Bitmap.scaleInto () to resize the transparent bitmap images in my application. Although this feature is a nice addition to JDE 5, it tends to produce bad results on the transparent bitmaps such as PNG24 files. The Forum posts that I found on the web for this problem talk using Bitmap.createAlpha () which restores transparency, but still produces artifacts in the final bitmap as the white edges and colours of the wicked pixels.

    To resolve this problem without the use of an external library, I created the following function. He always uses scaleInto(), but in a different way. I added some comments in the service and created a screenshot showing the results before and after (don't worry about the photos, they are a part of this project, I am working currently on). I write the result here in the hope that it will help others looking to achieve the same thing. The code has been tested in JDE 5 and 6 of JDE and the sample photos have been created using different combinations of types of filters and reports l / h.

    package com.patchou.ui;import net.rim.device.api.system.Bitmap;import net.rim.device.api.ui.Color;import net.rim.device.api.ui.Graphics;/** * * @author    Patchou * @version   1.01 * */public class GPATools{    /**     * Resizes a bitmap with an alpha channel (transparency) without the artifacts introduced     *   by scaleInto().     *     * @param bmpSrc        Source Bitmap     * @param nWidth        New Width     * @param nHeight       New Height     * @param nFilterType   Filter quality to use. Can be Bitmap.FILTER_LANCZOS,     *                           Bitmap.FILTER_BILINEAR or     *                           Bitmap.FILTER_BOX.     * @param nAspectRatio  Specifies how the picture is resized. Can be     *                           Bitmap.SCALE_TO_FIT,     *                           Bitmap.SCALE_TO_FILL or     *                           Bitmap.SCALE_STRETCH.     * @return              The resized Bitmap in a new object.     */    public static Bitmap ResizeTransparentBitmap(Bitmap bmpSrc, int nWidth, int nHeight, int nFilterType, int nAspectRatio)    {        if(bmpsrc== null)            return null;
    
            //Get the original dimensions of the bitmap        int nOriginWidth = bmpSrc.getWidth();        int nOriginHeight = bmpSrc.getHeight();        if(nWidth == nOriginWidth && nHeight == nOriginHeight)            return bmpSrc;
    
            //Prepare a drawing bitmap and graphic object        Bitmap bmpOrigin = new Bitmap(nOriginWidth, nOriginHeight);        Graphics graph = Graphics.create(bmpOrigin);
    
            //Create a line of transparent pixels for later use        int[] aEmptyLine = new int[nWidth];        for(int x = 0; x < nWidth; x++)            aEmptyLine[x] = 0x00000000;        //Create two scaled bitmaps        Bitmap[] bmpScaled = new Bitmap[2];        for(int i = 0; i < 2; i++)        {            //Draw the bitmap on a white background first, then on a black background            graph.setColor((i == 0) ? Color.WHITE : Color.BLACK);            graph.fillRect(0, 0, nOriginWidth, nOriginHeight);            graph.drawBitmap(0, 0, nOriginWidth, nOriginHeight, bmpSrc, 0, 0);
    
                //Create a new bitmap with the desired size            bmpScaled[i] = new Bitmap(nWidth, nHeight);            if(nAspectRatio == Bitmap.SCALE_TO_FIT)            {                //Set the alpha channel of all pixels to 0 to ensure transparency is                //applied around the picture, if needed by the transformation                for(int y = 0; y < nHeight; y++)                    bmpScaled[i].setARGB(aEmptyLine, 0, nWidth, 0, y, nWidth, 1);            }
    
                //Scale the bitmap            bmpOrigin.scaleInto(bmpScaled[i], nFilterType, nAspectRatio);        }
    
            //Prepare objects for final iteration        Bitmap bmpFinal = bmpScaled[0];        int[][] aPixelLine = new int[2][nWidth];
    
            //Iterate every line of the two scaled bitmaps        for(int y = 0; y < nHeight; y++)        {            bmpScaled[0].getARGB(aPixelLine[0], 0, nWidth, 0, y, nWidth, 1);            bmpScaled[1].getARGB(aPixelLine[1], 0, nWidth, 0, y, nWidth, 1);
    
                //Check every pixel one by one            for(int x = 0; x < nWidth; x++)            {                //If the pixel was untouched (alpha channel still at 0), keep it transparent                if(((aPixelLine[0][x] >> 24) & 0xff) == 0)                    aPixelLine[0][x] = 0x00000000;                else                {                    //Compute the alpha value based on the difference of intensity                    //in the red channel                    int nAlpha = ((aPixelLine[1][x] >> 16) & 0xff) -                                    ((aPixelLine[0][x] >> 16) & 0xff) + 255;                    if(nAlpha == 0)                        aPixelLine[0][x] = 0x00000000; //Completely transparent                    else if(nAlpha >= 255)                        aPixelLine[0][x] |= 0xff000000; //Completely opaque                    else                    {                        //Compute the value of the each channel one by one                        int nRed = ((aPixelLine[0][x] >> 16 ) & 0xff);                        int nGreen = ((aPixelLine[0][x] >> 8 ) & 0xff);                        int nBlue = (aPixelLine[0][x] & 0xff);
    
                            nRed = (int)(255 + (255.0 * ((double)(nRed-255)/(double)nAlpha)));                        nGreen = (int)(255 + (255.0 * ((double)(nGreen-255)/(double)nAlpha)));                        nBlue = (int)(255 + (255.0 * ((double)(nBlue-255)/(double)nAlpha)));
    
                            if(nRed < 0) nRed = 0;                        if(nGreen < 0) nGreen = 0;                        if(nBlue < 0) nBlue = 0;                        aPixelLine[0][x] = nBlue | (nGreen<<8) | (nRed<<16) | (nAlpha<<24);                    }                }            }
    
                //Change the pixels of this line to their final value            bmpFinal.setARGB(aPixelLine[0], 0, nWidth, 0, y, nWidth, 1);        }        return bmpFinal;    }}
    
    
    
    

    Here's an example of how to call the function:

    Bitmap bmp = Bitmap.getBitmapResource("picture.png");Bitmap bmpResized = GPATools.ResizeTransparentBitmap(bmp, 30, 60,    Bitmap.FILTER_LANCZOS, Bitmap.SCALE_TO_FIT);
    

    Here is the result:

    Let me know if you find this useful, all comments are appreciated .

    Cyril

    Thank you . I made a minor adjustment to the code (to check if the size of the original image is identical to the desired size). For some reason, I can't edit my original post that I posted the latest version on my blog. Links: http://www.patchou.com/2010/10/resizing-transparent-bitmaps-with-the-blackberry-jde/ .

    Moderator note: I've updated the code in the original post to match the latest version.

  • Resize the Bitmap image in the image control in flex3

    I'm loading an image in the image at the start control. Then I am a color transformation applying to this image and want to load this bitmap in flex3. That works, but automatic resizing does not work then. If I load another image, then AutoSize works well. Image control does not support resizing of the same bitmap object image?.

    Here is the part of the code:
    < mx:Image source = "{imgpath}" id = creationComplete = "imageCompleted ('MyImage'); "x ="20"y ="30"width ="365"height ="440"maintainAspectRatio = 'true '.
    / >
    private void applyColor(event:Event):void {}

    myBitmapDataObject = new BitmapData (myImage.height, true, myImage.width, 0x00CCCCCC);

    myBitmapDataObject.draw (myImage.content);
    myBitImage = new Bitmap (myBitmapDataObject);

    myBitmapDataObject.colorTransform (myBitmapDataObject.rect, new ColorTransform (1, 1, 1, 1, 39, 76, 135, 100));
    myImage.removeChildAt (0)
    myImage.load (myBitImage);


    }

    Any help is appreciated.

    You must create the BitmapData as the size of the original loaded image, not mx:Image height and width. Simply convert you / copy only a portion of the original size that matches the size of the Image. That is to say. whether you have a picture of 400 x 400 and your Image is 100 x 100. Your BitmapData is created at 100 x 100, NOT 400 x 400, you need to do. Everything simply because you resize the Image, does not mean that the underlying BitmapData is also resized.

    Also, in general, addChild would serve after removeChild, never used charge myself. Not sure if this is important.

  • Need to resize in version 12

    Just had a designed logo and I would like to add to my existing photos.  How to resize and change the transparency of the logo when the application of an existing photo.  Everything I've tried so far just logo covers the photo and I can't move or resize a lot less change the transparency.  I am an amateur and really don't want to put a lot of money for photoshop itself.

    I can help with the part of resizing and positioning, I think.  I'm less sure that you let the PSE12 and usually work in Photoshop, himself and that, rarely.

    Open your logo.png in a tab of the editor of PES.  Make sure that you are in Expert mode.

    Open a picture you want to put on, in another tab.

    Go to the logo tab and click Ctrl + A (select all) then Ctrl-C (Edition/copy).  This operation copies the logo to the Clipboard.

    Switch to the tab with the image you want to add the logo to, then press Ctrl + V (editing / paste).  This should put the logo as a new layer above the image.  It will probably cover more too much of the image and being in the wrong place.  That's ok.

    You may have gotten that well before.

    To make the logo of a different size, press Ctrl-T (Image/transformation/Free Transform) and press Ctrl-0 (view/Fit-on screen) to adapt to the larger box on the screen so that you can drag across.

    Now check the box keep the Proportions in the options of transformation in the lower left corner, so the logo remains a square and click-and - drag the corners of the logo to resize and position.  If there is a scale option, you can choose to prevent from rotate or distort the logo when you drag.

    Once the logo is all within the limits of the image that you put in, on, then you can do Ctrl-0, again, to mount this image in the window, or even more make things exactly where you zoom in.

    Once the logo is the right size and position, you can press the Enter key or click on the green check mark to validate the transformation towards the content of the logo layer.  You can move the logo around using the pointer of four arrows at the top left of the Toolbox to the left - at least where it is in mode Expert PSE11.

    I'll leave to others to help you make more transparent and other colors in addition to black and white.

  • Several Spritesheets making the game unplayable (CreateJS)

    I m working on a game that has a lot of bitmaps (> 1000) which are distributed to more than 2 8Kx8K spritesheets.

    Now animate created a 2nd Spritesheet game became unplayable (from 60 fps to 5 frames per second).

    Now I have to go back to the single image to load, which is a pain, because the loading time was preety much triple.

    Similar experiments by developers who are trying to make a game of medium size with hundreds of assets in canvas?

    PreloadJS preload everything before letting the page start playing, so it wouldn't matter what order things are in. Have you tried a drop down for sizes spritesheet still more small, like 1024 x 1024 or even 512 x 512?

    Some of the advice in this thread can help: aseljs http://stackoverflow.com/questions/11173322/speed-of-large-amount-of-animated-bitmaps-in-e

  • Compression speed

    Hello

    We are experimenting with compression find etl more slow which is what I expected from uncompressed table.

    Using Oracle 11.2.0.3 and try for oltp on a large fact table and base have a lot of bitmap index.

    User reporting reporting queries access the compressed table up to 3 x more slow comapre to the equivalent uncompressed table.

    Looking at the forums and manuals suggest etl can be slower - fine we have a lot of time to load but the reports would not negatively affacted.

    Someone else has seen this?

    Thank you

    user5716448 wrote:

    Another team is doing performance audits - they conclude that compression has an impact on the cpu too heaviily compared to the dinetcial queries against uncompressed version HE table and decided to not continue not smooth. Key benefits we hoped to reach on the drive (this a 1/3 of the size of the original) and gear (including approximately 3 slower tiimes in perf teams controls)

    A third less of disk space is credible, 3 times slower using the same execution plan is difficult to believe - despite an increase in CPU is something, we would expect to. Of course, if you're talking about a query that is used to take 1/10th of a second account now 3/10th of a second I would not be surprised - the absolute difference is not significant and could be explained by an increase in CPU; But if you talk about 1 minute in expansion to 3 minutes, I'd be surprised.

    I'd also be interested in the other team how their tests - is possible only after having compressed tables their ETL introduced a lot of updates after the direct path of transformation inserts - thus the introduction of a huge volume of chained rows? That could easily have the type of performance impact as you talk.

    The information you gave us is too vague, although - how about you give us an example of a query that is running three times more slowly, with the front and after execution plans and statistics of a trace file (level 8), which has been passed through tkprof. A report on the session statistics (change) because of the query could also be an important source of useful information - it could, for example, show us a very large number of "fetch table by continuous row."

    One question that I raised by another Member of the team has been compression of entire database rather than just a compression table.

    It's the kind of question that suggests that the team does not know how to see the results of their tests. If they knew why the time of the query has been slower that they wouldn't need to ask the question – as it is that they're just hoping for a miracle.

    Concerning
    Jonathan Lewis

  • Memory retains increaing and this VI a lot of resizing of memory allocation events

    This application increases slowly the memory and after 12 hours, I'll get labview for error memory. With the desktop execution Trace Tool kit, I found Vi (attached) is called a lot and a lot of memorry allocate, free one resize events.

    I have this Aplication but I see that the reference is not closed, I do not see the leaks of reference on the destkop trace Toolkit

    guys do you have an idea what could be?

    After 17 hours and 47 minutes the progam still works. These reference was the problem. they appear to be leaks of reference on the trail of the funds taken kit until I closed the program.

    Thank you

  • Beginner: OutOfMemory Error when resizing Bitmap

    I get OutOfMemory error when I tried to get the bitmap off EncodedImage

    backgroundBitmap = Bitmap.getBitmapResource ("bitmap.png")

    image = PNGEncodedImage.Encode (backgroundBitmap);
    image = image.scaleImage32 (Display.GetWidth (), Display.getHeight ());
    _backgroundBitmap = image.getBitmap ();

    the red line causes this problem, can someone help me out on this please? is there another method I can try to achieve the same result?

    Thank you...

    Hello

    you use scaleImage32 the wrong way, try this that method or rather. You can also resize bitmap image without code it first.

    Kind regards

    Piotr

  • Resize the Bitmap and get changed background = /...

    Hi I have a simple code for mounira a bitmap, but, when I get the new resized Bitmap of it have a black background? and I don't want to. Here's the code.

    public class ImageUtils {
    
        public static Bitmap resizeImage(Bitmap originalImage, int newWidth, int newHeight) {
            Bitmap newImage = new Bitmap(newWidth, newHeight);
            originalImage.scaleInto(newImage, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);
            return newImage;
        }
    }
    

    Try this:

    http://supportforums.BlackBerry.com/T5/Java-development/resizing-transparent-bitmaps/Ta-p/703239

  • Resizing a bitmap using .scaleImage32 instead of .setScale

    I have a simple piece of code that I created and which takes a string (the name of the image), gets the image and reszies it and outputs a Bitmap file.

       public static Bitmap scaleBitmap(String imagename)
        {
            EncodedImage ei = EncodedImage.getEncodedImageResource(imagename);
            ei.setScale(2); 
    
            Bitmap bmp = ei.getBitmap();
            return bmp;
        }
    

    The problem is that .setScale is obsolete, and although still works, I want to make sure I use the latest features, so my app works in all areas. I want also to the scale not by half. I can't get .scaleImage32 to work tho.

       public static Bitmap scaleBitmap(String imagename)
        {
            int numerator = Fixed32.toFP(1);
            int denominator = Fixed32.toFP(2);
            int scale = Fixed32.div(numerator, denominator);
    
            EncodedImage ei = EncodedImage.getEncodedImageResource(imagename);
            ei.scaleImage32(scale, scale);
            Bitmap bmp = ei.getBitmap();
            return bmp;
        }
    

    I'm using it wrong?

    I test on the 8830 and the 9000. the results are the same on both, if resizes no problem, the scaleImage does not work.

    Try this:

    private Bitmap getScaledBitmapImage(String imagename)
        {
    
            EncodedImage image = EncodedImage.getEncodedImageResource(imagename); 
    
            int currentWidthFixed32 = Fixed32.toFP(image.getWidth());
            int currentHeightFixed32 = Fixed32.toFP(image.getHeight());
    
            int width = image.getWidth() /2;
            int height = image.getHeight() /2;
    
            int requiredWidthFixed32 = Fixed32.toFP(width);
            int requiredHeightFixed32 = Fixed32.toFP(height);
    
            int scaleXFixed32 = Fixed32.div(currentWidthFixed32, requiredWidthFixed32);
            int scaleYFixed32 = Fixed32.div(currentHeightFixed32, requiredHeightFixed32);
    
            image = image.scaleImage32(scaleXFixed32, scaleYFixed32);
    
            return image.getBitmap();
        }
    

    Concerning

    Bika

  • Try to resize a bitmap - FASTJPEG: progressive decoding is not supported

    Hi all

    I went through the forums and tried many examples to remedy this, but none of them have worked.

    I download a .jpg file from a URL of site Web, internal to our society, to get a photo of the employee.

    I then use the code to resize the image to 100 x 100, no matter what the image is the size I need to resize to 100 x 100.

    The last code I tried is as follows:

    EncodedImage image = EncodedImage.createEncodedImage(imageBytes, 0, imageBytes.length); 
    
            int currentWidthFixed32 = Fixed32.toFP(image.getWidth());
            int currentHeightFixed32 = Fixed32.toFP(image.getHeight());
    
            int width = 100;
            int height = 100;
    
            int requiredWidthFixed32 = Fixed32.toFP(width);
            int requiredHeightFixed32 = Fixed32.toFP(height);
    
            int scaleXFixed32 = Fixed32.div(currentWidthFixed32, requiredWidthFixed32);
            int scaleYFixed32 = Fixed32.div(currentHeightFixed32, requiredHeightFixed32);
    
            image = image.scaleImage32(scaleXFixed32, scaleYFixed32);
    
            return image.getBitmap();
    

    However, it is not hidden image and gives me the following error:

    FASTJPEG: Progressive decoding is not supported

    It does not for all images, only some of them.  I discovered that the images in this case on images jpeg at 300 dpi, while those who work well is 96 dpi.  Is this the reason why?  Is there a way that these images can be resized properly, even if they are 300 dpi?

    I have not control how these images are saved in our society, I just have to get them via Http and resize them to display nicely on the Blackberry screen.

    Thanks for any help you can give.  I will continue to try other things as much as possible.

    Kind regards

    David

    If you work with OS 5.0 +, you can try the native Bitmap scaling methods provided.

  • How to resize images to a specific size of lot? (URGENT!)

    I do not know how to batch resize photos using adobe bridge and then Tools > photoshop > image... processor and resize, but what I want to know is how to resize images to a size specific width and height of the lot without having to keep proportion.

    For now, I have a bunch of photos that are 2896 x 1944 pixels, but I need to resize up to 1920 x 1080 for a sequence of stop motion. But photoshop wants to keep in proportion and resizes 1608 x 1080, which is not what I want but I don't want to make them one at a time. so please help

    THX

    But photoshop wants to keep in proportion and resizes 1608 x 1080, which is not what I want but I don't want to make them one at a time. so please help

    You can do this by registering your own action in Photoshop (in the action panel) and use the image size command while unchecking the option to constrain the proportions. Then, you can fill in the size in pixels and include a save as command to close a document and a new location. Then select files in Bridge and via tools / Photoshop /Batch perform this action.

    However, if you do not change the proportions of your original photos will appear very tense because you change the proportions, I'm not sure that's what you want.

    You could also record an action to trim the originals of this size, leaving the look of the original image, only less at low, high or both. In doing so, all files are cropped to the same location that you saved the harvest on the first file.

  • Cannot get Bitmap to resize

    I have an image that I need to add programmatically to the scene.  In Flash CS4, I did an Import library, export for ActionScript, give it a name "myphoto", then inside a custom class that extends Sprite, I do this:

    var bmd:BitMapData = new myphoto (100.200);

    var myphotoBitMap:BitMap = new BitMap (bmd);

    addChild (myphotoBitMap);

    He appears on the scene much larger than 100 x 200.  I tried

    myphotoBitMap.width = 100;

    myphotoBitMap.height = 200;

    but that is ignored, the picture is still too wide.

    I tried resizing after the added events and AddedToStage, thinking maybe my resizing controls did not work because the image was being processed in some way, but this does not work either.

    Thank you!

    use:

    var bmd:BitmapData = new myphoto (0,0);

    var bmd1:BitmapData = new BitmapData (100.200);
    mat: matrix var new matrix());
    mat.a = 100/bmd.width;
    mat.d = 200/bmd.height;
    bmd1. Draw (BMD, Matt);

    var myphotoBitMap:Bitmap = new Bitmap (bmd1);

    addChild (myphotoBitMap);

Maybe you are looking for