title: How to save Image with its original size?
body: <p>In my Flex application I load an image into the Image control. After loading the image I can apply filters like color transform or grayscale etc and then I want to save the image with the filter applied. I am having trouble saving the image with the filters applied. With the following code the Image gets saved without the filters. However, if I use </p>
  
  <blockquote>
    <p>finalImagedata =
    ImageSnapshot.captureBitmapData(myImage);</p>
  </blockquote>
  
  <p>Then the image gets saved with filters applied but with the dimension of the image control. I want to save the image with its original dimension. To be clear, if the image is 1000px X 1000px and displayed in a 300px X 300px image control, while saving I still want to save the image with 1000px X 1000px dimesnion. How to do that? I have also tried to get BitmapData directly from the image control content like below but that doesn't seemt to work. Any help guys?</p>
  
  <blockquote>
    <p>finalImagedata =
    Bitmap(myImage.content).bitmapData;</p>
  </blockquote>
  
  <pre><code>            var filtersArray:Array = new Array;
              private var finalImagedata:BitmapData;
  
              private function loadImage(url:String):void
              {
                  var request:URLRequest = new URLRequest(url);
  
                  var imageLoader:Loader = new Loader();
                  imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, image_completeHanlder);
                  imageLoader.load(request);
              }
              private function image_completeHanlder(event:Event):void
              {
                  var bmd:BitmapData = Bitmap(event.currentTarget.content).bitmapData;
                  var bmpMy:Bitmap = new Bitmap(bmd);
                  myImage.data=bmpMy;
  
              }
              protected function button1_clickHandler(event:MouseEvent):void
              {
                  loadImage("http://localhost/main/image.jpg"); 
              }
  
              protected function prepareFinalImage():void
              {
                  finalImagedata = new BitmapData(myImage.content.width, myImage.content.height, true);
                  finalImagedata.draw (myImage.content);
              }
              protected function btnSave_clickHandler(event:MouseEvent):void
              {
                  prepareFinalImage();
  
                  var encoder:Object = new Object();
                  var defaultName:String;
  
                          var je:*;
                          je = new JPGEncoder(100);
                          encoder.encode = je.encode;
                          defaultName = "myImage.jpg";
  
  
                  var imageBytes:ByteArray = encoder.encode(finalImagedata);
                  var fr:FileReference = new FileReference();
                  fr.save(imageBytes,defaultName);
              }
  
  
              protected function btnGrayScale_clickHandler(event:MouseEvent):void
              {
                  var red:Number = 0.3086; // luminance contrast value for red
                  var green:Number = 0.694; // luminance contrast value for green
                  var blue:Number = 0.0820; // luminance contrast value for blue
                  var cmf1:ColorMatrixFilter = new ColorMatrixFilter([red, green, blue, 0, 0, red, green, blue, 0, 0, red, green, blue, 0, 0, 0, 0, 0, 1, 0]);
                  filtersArray.push(cmf1);
                  myImage.filters = filtersArray;
              }
  </code></pre>