0

I have a byte array that I want to save it as a bitmap image. what should I do? I saw android.graphics.Bitmap and found several methods but I don't know which one is suitable. createBitmap(int width, int height, Bitmap.Config config), for example. I have width and height but how can I give it my byte array?

Thanks

1 Answer 1

1

Check out the methods in the class BitmapFactory, e.g. public static Bitmap decodeByteArray(byte[] data, int offset, int length).

Offset should be 0 and the length should be array.length for you.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks dear mreichelt. may be a stupid question, sorry, but i ask. How it understand the width and height of my picture. actually, I had a picture then I extracted pixels and then manipulated pixels and know I want to save it with new name. this is my real problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.