BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 12-29-2008, 12:26 AM   #1 (permalink)
New Member
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 6
Post Thanks: 0
Thanked 0 Times in 0 Posts
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


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Square D 60 Amp 240VAC Single Throw Safety Switch 3P, H322NRB
$265.4
Square D 60 Amp 240VAC Single Throw Safety Switch 3P, H322NRB pictureLincoln Invertec V350-PRO Welder Breaker Switch - - Part# M19234 - Used
$55.0
Lincoln Invertec V350-PRO Welder Breaker Switch -  - Part# M19234 - Used picture1PCS NEW Yamatake Azbil FL7M-2J6HD-L5 Proximity Switch
$49.0
1PCS NEW Yamatake Azbil FL7M-2J6HD-L5 Proximity Switch pictureSYLVANIA 120/277 Volts Zip-Set Industrial Digital Time Switch
$30.0
SYLVANIA 120/277 Volts Zip-Set Industrial Digital Time Switch pictureABB OHG Pistol handle switch 125J10 125MM Type 3R
$35.0
ABB OHG Pistol handle switch 125J10 125MM Type 3R picture






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