Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8246261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:26:56+00:00 2026-06-07T22:26:56+00:00

I’m trying to convert the byte array image to bitmap, but after conversion it

  • 0

I’m trying to convert the byte array image to bitmap, but after conversion it gives me black image, why?

// Camera arg conversion to Bitmap
                Bitmap cameraBitmap = BitmapFactory.decodeByteArray(arg0, 0,
                        arg0.length);
                 Bitmap background = Bitmap.createBitmap(cameraBitmap.getWidth(),
                 cameraBitmap.getHeight(), Bitmap.Config.ARGB_8888);

I want the camera image converted to bitmap. Any suggestion. Thanks in advance!!

07-17 02:22:18.149: E/AndroidRuntime(398): FATAL EXCEPTION: main
07-17 02:22:18.149: E/AndroidRuntime(398): java.lang.IllegalArgumentException: only support ImageFormat.NV21 and ImageFormat.YUY2 for now
07-17 02:22:18.149: E/AndroidRuntime(398):  at android.graphics.YuvImage.<init>(YuvImage.java:82)
07-17 02:22:18.149: E/AndroidRuntime(398):  at com.exercise.AndroidCamera.AndroidCamera$4.onPictureTaken(AndroidCamera.java:225)
07-17 02:22:18.149: E/AndroidRuntime(398):  at android.hardware.Camera$EventHandler.handleMessage(Camera.java:320)
07-17 02:22:18.149: E/AndroidRuntime(398):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-17 02:22:18.149: E/AndroidRuntime(398):  at android.os.Looper.loop(Looper.java:123)
07-17 02:22:18.149: E/AndroidRuntime(398):  at android.app.ActivityThread.main(ActivityThread.java:4627)
07-17 02:22:18.149: E/AndroidRuntime(398):  at java.lang.reflect.Method.invokeNative(Native Method)
07-17 02:22:18.149: E/AndroidRuntime(398):  at java.lang.reflect.Method.invoke(Method.java:521)
07-17 02:22:18.149: E/AndroidRuntime(398):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-17 02:22:18.149: E/AndroidRuntime(398):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-17 02:22:18.149: E/AndroidRuntime(398):  at dalvik.system.NativeStart.main(Native Method)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:26:58+00:00Added an answer on June 7, 2026 at 10:26 pm

    Unfortunately, the camera’s image format is not ARGB_8888. Most likely it’s something like YUV420p or maybe even the JPEG-compressed data.

    First of all, determine what is your case.

    You have two options: for YUV (which is an interleaved format) use some conversion format and for JPEG create a memorystream for your arg0 array and read the Bitmap from it.

    There are similar questions here: BitmapFactory null issue in android

    And there is even a solution here: Android byte[] to image in Camera.onPreviewFrame

    EDIT: you just have to mangle the bytes in your array a little.

    This wiki article explains how to convert the YUV422/420 to YUY2, required by the Android API.
    Search for the “Y’UV422 can also be expressed in YUY2 FourCC format code” substring there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.