koti
koti

Reputation: 3701

how to do image resize without distortion in Blackberry

I am downloading an image from the web and applying fixed32 method to resize the image to fit to screen. Resizing the image causes some loss of clarity, but my client wants to display the image without this distortion. How can I do this?

Upvotes: 0

Views: 505

Answers (2)

Rajkiran
Rajkiran

Reputation: 259

Use following method for resizing image.

public static Bitmap SizePic (EncodedImage Resizor,int Height, int Width) {
    int multH;
    int multW;
    int currHeight = Resizor.getHeight();
    int currWidth = Resizor.getWidth();`enter code here`
    multH= Fixed32.div(Fixed32.toFP(currHeight),Fixed32.toFP( Height));
    multW = Fixed32.div(Fixed32.toFP(currWidth),Fixed32.toFP(Width));
    Resizor = Resizor.scaleImage32(multW,multH);
    return Resizor.getBitmap();
}

Upvotes: 0

rfsk2010
rfsk2010

Reputation: 8611

The way I do this is to not resize the image in the phone. I request my server to send me image based on the width*height I need. The server then resizes the image for me. How about you try a similar solution. This would help you by providing a proper resized image, and improve performance of your app.

Upvotes: 4

Related Questions