BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 12-29-2008, 12:26 AM   #1
abhijeetrajenamdeo
New Member
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 6
Default Image Thumbnailing Issue.

Please Login to Remove!

Hi All,



I developed an application using J2me for creating thumbnails of images. I used this application on Blackberry 8100, 8300 and 8800 devices, It makes proper thumbnail of image (where Image size is 10~50 KB).



While trying to create thumbnails of images (where Image size is 10~20 KB), the same code for Blackberry-Bold throws OutOfMemory exception . It only create thumbnails of size 5~7 KB images.



I need your expertise to resolve this problem. I want to use J2me code only that also works for Blackberry-Bold.



Here i am adding some part of J2me code that creates thumbnail.



public static Image getThumbnail(Image img, int intScreenWidth, int intScreenHeight) {

// Declaration
Image imgThumb = null;
Image imgImmutableThumb = null;
// getting original width
int intImageWidth;
// getting original height.
int intImageHeight;
try {
intImageWidth = img.getWidth();
// getting original height.
intImageHeight = img.getHeight();
// now getting the thumb image
imgThumb = Image.createImage(intScreenWidth, intScreenHeight);
if (imgThumb != null) {
Graphics g = imgThumb.getGraphics();
for (int y = 0; y < intScreenHeight; y++) {
for (int x = 0; x < intScreenWidth; x++) {
g.setClip(x, y, 1, 1);
int deltaX = x * intImageWidth / intScreenWidth;
int deltaY = y * intImageHeight / intScreenHeight;
g.drawImage(img, x - deltaX, y - deltaY,
Graphics.LEFT | Graphics.TOP);
}// end of for (int x = 0; x < intScreenWidth; x++)
}// end of for (int y = 0; y < intScreenHeight; y++)
// imgImmutableThumb = Image.createImage(imgThumb);
} else {
imgThumb = img;
}

} catch (OutOfMemoryError ome) {

} catch (Exception e) {
//e.printStackTrace();
} finally {

}// end of try catch finally.
return imgThumb;
}// end of getThumbnail



It throws exception from Image.createImage().



Please reply me as soon as possible.



Thanks in advance.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


CBB61 250V  Capacitor 2 wires 1/2/3/3.5/4/5/6/7/8/9/10/12/15/18/20/24/25/30 UF picture

CBB61 250V Capacitor 2 wires 1/2/3/3.5/4/5/6/7/8/9/10/12/15/18/20/24/25/30 UF

$129.95



6.3V 10V 16V 25V 35V 50V 100V 400V SMD Aluminum Electrolytic Capacitor 1-1000 UF picture

6.3V 10V 16V 25V 35V 50V 100V 400V SMD Aluminum Electrolytic Capacitor 1-1000 UF

$155.59



45/5 MFD ±5% Dual Run Capacitor 370 450 VAC CBB65 AC Motor HVAC 45+5 uF Fan 10pk picture

45/5 MFD ±5% Dual Run Capacitor 370 450 VAC CBB65 AC Motor HVAC 45+5 uF Fan 10pk

$85.99



5pc Radial Electrolytic Capacitor 250V 100V 50V 25V 16V 0.22uF-4700uF 10000uF picture

5pc Radial Electrolytic Capacitor 250V 100V 50V 25V 16V 0.22uF-4700uF 10000uF

$22.99



1/5pcs 100V~400V 0.1uF~100uF MKP Audio Metallized Polypropylene Film Capacitor picture

1/5pcs 100V~400V 0.1uF~100uF MKP Audio Metallized Polypropylene Film Capacitor

$63.90



500pc Radial Electrolytic Capacitor Assortment Kit 24 Value 0.1uF-1000uF 10V-50V picture

500pc Radial Electrolytic Capacitor Assortment Kit 24 Value 0.1uF-1000uF 10V-50V

$13.04







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.