Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Bitmap scaling sample app

The bitmap scaling sample application demonstrates how to scale the size of a Bitmap image.

The sample application demostrates how to scale an original Bitmap image into new Bitmap objects, how to apply filters that help reduce the pixelated appearance of a scaled Bitmap image, and how to preserve the aspect ratio of the image.

File name



  • contains the entry point for the sample application
  • contains the BitmapScalingDemo() constructor that creates and displays the BitmapScalingDemoScreen
  • contains the inner class BitmapScalingDemoScreen that creates a Bitmap image from a source file, scales the original image and displays Bitmap objects with different filters and aspect ratios

This sample features the following classes:


This class represents a Bitmap image that can be displayed on the BlackBerry device. The Bitmap class provides the scaleInto() method that scales the Bitmap image and stores the scaled image in the Bitmap object that is passed in as a parameter. The scaleInto() method takes parameters that you can use to preserve the aspect ratio of the image, and specify filters to reduce the pixelation of the scaled image.

The sample application uses the scaleInto() method to create scaled Bitmap images with different filters and aspect ratios.

Install the sample app

Visit www.blackberry.com/go/bitmapscalingsample to download the sample application.

Extract the bitmapscalingdemo.zip file.

On the taskbar, click Start > Programs > Research In Motion > BlackBerry JDE 5.0 > JDE.

Open the workspace that you want to add the sample application to.

In the workspace tree, right-click the project that you want to add the sample application to.

Click Add project to <workspace folder>.

In the Add project to <workspace> dialog box, navigate to the folder where you extracted the sample application.

Click the BitmapScalingDemo.jdp file.

Click Open.

The sample app is also available in github.

Run the sample app

In the workspace where you added the bitmapscalingdemo project, right-click bitmapscalingdemo.

Click Build project.

On the taskbar, click Start > Applications > Research in Motion > BlackBerry JDE 5.0 > Device Simulator.

On the Home screen of the BlackBerry Smartphone Simulator click the Downloads folder.

Click the Bitmap Scaling Demo icon.