Hi all,
I found the solution for this. I have given the code below it may
helpful for anyone looking for the same.
Code:
import mx.graphics.codec.JPEGEncoder;
private function saveImage():void{
var byteArray:ByteArray=new ByteArray();
var bmd:BitmapData=new
BitmapData(img.width,img.height);
bmd.draw(img);
var jpg:JPEGEncoder=new JPEGEncoder(60);
byteArray=jpg.encode(bmd);
var
fl:File=File.desktopDirectory.resolvePath("img.jpg");
var fs:FileStream = new FileStream();
try{
fs.open(fl,FileMode.WRITE);
//
fs.writeUTFBytes(CompressUtil.compress(encodedData));
fs.writeBytes(byteArray);
fs.close();
}catch(e:Error){
trace(e.message);
}
}
]]>
</mx:Script>
<mx:Image source="image.jpg" id="img" width="300" height="300"/>
<mx:Button label="Sava" click="saveImage()" />
Regards,
Kishore.V
On Dec 5, 1:02 pm, "kishore.v" <[EMAIL PROTECTED]> wrote:
> Hi Guys,
>
> Currently I am working one Album Project using Flex and AIR. I face
> one problem while loading larger size images, it taking much time to
> load and sometimes systems will hangs. The application is working fine
> while using smaller size images (assuming below 1000 X 1000 pixels). I
> understand that flash player will support maximum 2880 x 2880 pixels.
> Is that AIR also will supports the same?
> Is there any way to compress images at runtime and save the file?
> Please let me know the solution for it and give me the suggestion how
> to proceed.
> I am assuming that this will be possible by using ImageSnapshot, JPEG
> encoder and PNG encoder please let me know my assumption is right or
> not?
>
> Thanks for advance
>
> Kishore.V
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---