Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have byte array img
Java
image = new GraphicObject(BitmapFactory.decodeByteArray(img, 0, isize));

Please help.
Posted

1 solution

You can use scale transform to change the size of the image. If scaling is above one , it will zoom the image.


Java
public static Bitmap scaleImage(Bitmap src,float sx,float sy)
{
    Matrix matrix = new Matrix();
    matrix.postScale(sx, sy);
    src=Bitmap.createBitmap(src, 0, 0,   src.getWidth(), src.getHeight(), matrix, true);
    return src;
}


If you have byte array, you can convert that to Bitmap object and can call this method.

Here is how you can convert it to byte array.

Java
Bitmap.createBitmap(image, w, h, android.graphics.Bitmap.Config.ARGB_8888);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900