Scale image and save as new jpeg

Hi Folks,

Just wondering if it is possible. I’m looking for a way to create thumbnails from high-resolution images taken with the smartphone’s camera.

If I load an image (displayObject) from a file, scale it to say 200x200 and show it on screen, will it have this resolution when I save it to a file using display->save?

If there’s another display object on top of the image during the save action (for instance an activity indicator, or a sprite), will this affect the way the file is saved?

Thanks for responding!

~Rob.

Hi

Yes its possible.

Insert the scaled image in a display group with nothing else in and use:

display.save ( group, "thumb.jpg ) 

and you will achieve what you want.

Hi Ojnab,

Thanks for the quick response!

So the only rule is that the image must reside completely within the boundaries of the device’s screen? And it does not matter if any other object or display group is positioned over the image?

That would pretty much solve my problem. My app is working with many pictures that are taken with the camera of the device. If they are all loaded in memory, that seriously slows down (or even hangs!) my app. Now I can scale them down to the device’s native res (or even smaller). Yahoo :slight_smile:

There are 3 options: to capture screen, to capture part of screen and to capture display group/object (which can be even hidde beneath visible objects). Check api, there should be everything :slight_smile:

Hi

Yes its possible.

Insert the scaled image in a display group with nothing else in and use:

display.save ( group, "thumb.jpg ) 

and you will achieve what you want.

Hi Ojnab,

Thanks for the quick response!

So the only rule is that the image must reside completely within the boundaries of the device’s screen? And it does not matter if any other object or display group is positioned over the image?

That would pretty much solve my problem. My app is working with many pictures that are taken with the camera of the device. If they are all loaded in memory, that seriously slows down (or even hangs!) my app. Now I can scale them down to the device’s native res (or even smaller). Yahoo :slight_smile:

There are 3 options: to capture screen, to capture part of screen and to capture display group/object (which can be even hidde beneath visible objects). Check api, there should be everything :slight_smile: