# Snapshot from Bitmap

**URL:** <https://forum.kirupa.com/t/snapshot-from-bitmap/308176>\
**Category:** flash\
**Created:** [April 18, 2010, 1:59pm UTC](https://forum.kirupa.com/t/snapshot-from-bitmap/308176 "2010-04-18T13:59:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![raack08](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@raack08](https://forum.kirupa.com/u/raack08)\
**Post date:** [April 18, 2010, 1:59pm UTC](https://forum.kirupa.com/t/snapshot-from-bitmap/308176/1 "2010-04-18T13:59:03Z")

</div>

Hi’ all,

I have a little problem with taking a snapshot of a loaded bitmap.

This is my script;

```auto

function captureImage():Void{
    
    //normzalize the scale
    scale /= 100 
    
    
   _bmp = new BitmapData( masker._width, masker._height ); // creates the bitmap of the mask's size

    m = new Matrix();
    
    m.rotate((degrees/360) * Math.PI);

    m.scale(scale, scale);
    
     m.translate( -imageloader._x, -imageloader._y); // Create the matrix used to translate the positions of the source image.

// draw the bitmapdata considering the offset of the mask
_bmp.draw(imageloader, m);

    pixels = new Array();
    var w:Number = _bmp.width;
    var h:Number = _bmp.height;
    for (var a = 0; a<=w; a++) {
        for (var b = 0; b<=h; b++) {
            var tmp = _bmp.getPixel(a, b).toString(16);
            pixels.push(tmp);
        }
    }
    

   this.attachBitmap(_bmp, 0);
    //_bmp.dispose();
    
}

```

Now, the scaling works fine. Only problem is the x and y position of the imageloader. You kan move the image around by dragging the imageloader and zoom in- or out for scaling, but the x, y differs from the dragged image. See example in attachement.

fyi; trying to achieve something like elf yourself…

hope somebody can drop a hint. I think it has to be something with the translate positions.

thx.

Gr,  
raack
