10-25-2009 08:06 AM
Hi,
i am getting variable Fixed32 error;
if i declare it has int; it says int cannot be dereferenced.
please help is ther any api i need to import for this.
thanks in advance.
11-01-2010 08:03 AM
Hi ,
I have an image with 2.19 MB on my blackberry gallery. When I open it using native, it srinks the image perfectly to the screen and shows
I need to do the same when the user clicks on my image inside my application. when i used the code provided by Bikas, it fits to screen but cant see the entire image.. may be first half streched.
can anyone help me how to fit the bigger size image to the screen? Basically shrink it with gud display to the screen?
Thanks
Bhuvana
12-11-2012 09:11 AM
I'm having some trouble getting this working... I just want to scale my image down by half. When I check getWidth and getHeight after doing scaleImage32 the image is the same dimensions. Am I doing something wrong here. I tried calling it with
scaleImage(data, 0.5);
public static byte[] scaleImage(byte[] data, double scale) {
EncodedImage image = EncodedImage.createEncodedImage(data, 0, data.length);
int currentWidth32 = Fixed32.toFP(image.getWidth());
int currentHeight32 = Fixed32.toFP(image.getHeight());
int requiredWidth = (int) (image.getWidth() * scale);
int requiredHeight = (int) (image.getHeight() * scale);
int requiredWidth32 = Fixed32.toFP(requiredWidth);
int requiredHeight32 = Fixed32.toFP(requiredHeight);
int scaleXFixed32 = Fixed32.div(currentWidth32, requiredWidth32);
int scaleYFixed32 = Fixed32.div(currentHeight32, requiredHeight32);
EncodedImage scaledImage = image.scaleImage32(scaleXFixed32, scaleYFixed32);
Utils.log("Image now has size: " + scaledImage.getWidth() + "x" + scaledImage.getHeight());
return scaledImage.getData();
}
12-12-2012 12:24 AM
Does the code here actually shrink the file size? I should perhaps ask that.
12-12-2012 04:34 PM - edited 12-12-2012 04:36 PM
It can. But see your other posts before using it.