How can I reduce resolution of captured with a device camera image?

I write an application that captures a photo with a camera (with media.show() command) and sends the image to the server. The server doesn’t accepts files that have more than 2MB size. So we have problem if user takes a picture in a high resolution and tries to send it to the server.

How can I check the resolution of the captured with camera image and if can I reduce it if it needed?

I tried the follow code:

[lua]image1 = display.newImageRect(“CameraShot.jpg”, system.TemporaryDirectory, 800 , 480)
display.save( image1 ,“Sent2ServerImage.jpg”, system.TemporaryDirectory )[/lua]

“Sent2ServerImage.jpg” - the image file that user sends to the server

I received that only 1/4 of image (the bottom left quarter) is sent to the server instead of the whole image.

Any other ideas? Thanks [import]uid: 172733 topic_id: 34038 reply_id: 334038[/import]