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

  • SEARCH
  • Home
  • 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 7502467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:53:05+00:00 2026-05-29T20:53:05+00:00

I have a Galaxy Note device and I wrote an application that grabs uimages

  • 0

I have a Galaxy Note device and I wrote an application that grabs uimages from the camera.
I have set the layout to landscape and I am able to grab images with my device. The problem is when I run the same program on someone else’s device.
The program runs the same on the other device, but when saving a picture the content of the picture is wrong. You see slightly diagonal strpies instead of the image content.
I think it’s the result of the image being saved with the wrong pitch or resolution.
The thumbnail of the “bugged” picture on the other device is for some kind of a reason corret.
I have tried to find the difference between my device and the other device, but apart from one having a resolution of 1280×800 and the other of 800×480, I didn’t find any difference. In both cases the Measur and Layout functions have a 90 degrees orientation and the correct landscape resolution. In both cases the image format is JPEG(by inquiring mCamera.getParameters().getPictureFormat()).
I am stumped, I am don’t know what to do, because everything seems the same except that one device spits the correct JPEG byte array, and the other gives me the correct data but with the wrong orientation. Or so it seems.

EDIT: I found that there is an issue even when I save the raw data straight into a JPEG file, so no display or decode is involved. I can see in the Gallery browser that the JPEG file has artifacts, is wrong somehow.
My code for saving the camera data into a (JPEG) file is as following:

private File onJPGPreviewFrame(byte[] data, String Name) {
    FileOutputStream outStream = null;
    File f = null;
    try {
        if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { 
            File externalRoot = Environment.getExternalStorageDirectory(); 
            File tempDir = new File(externalRoot, Name); 
            tempDir.createNewFile();
            outStream = new FileOutputStream(tempDir);  
            outStream.write(data);
            outStream.close();
            f = tempDir;
        }

        Log.d(TAG, "onPreviewFrame - wrote bytes: " + data.length);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
    }
    return f;
}
  • 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-05-29T20:53:05+00:00Added an answer on May 29, 2026 at 8:53 pm

    The device screen resolution has a different aspect ratio than the device’s camera resolution. If you choose the preview to have the same aspect ratio as the camera’s aspect ratio, then the jpeg byte array data will not be “bugged”.
    The problem with this is that the preview is going to be distorted because it doesn’t match the screen’s aspet ratio.
    Here is some code I used to find the optimal aspect ratio:

    private Size getOptimalPreviewSize(List<Size> sizes, int width, int height) 
    {            
        Size optimalSize = null;                                 
    
        double targetRatio = (double) width / height;
        int Max = 0;
    
        for (Size size : sizes) 
        { 
            double ratio = (double) size.width / size.height;
            int m = size.width * size.height;
            if (m>Max && (ratio == targetRatio)) 
            {
                Max = m;
                optimalSize = size; 
            }                
        } 
    
        if (optimalSize == null) 
        { 
            // TODO : Backup in case we don't get a size. 
        } 
    
        return optimalSize; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that plays a video from the sdcard with MediaPlayer. I
I have a samsung galaxy s and i have made an application that make
I have a weird issue that only occurs on the Samsung Galaxy Note. I
I have an Activity that opens the Camera and starts a preview on a
I have an app that runs fine on my Galaxy S2 and many other
I have written a simple Android application that uses a sqlite database which is
I have a Galaxy Tab 1000. I am trying to write a code, that
I have a Samsung Galaxy Tab (Android 2.2 Froyo, etc) that I am developing
I am using Samsung Galaxy Note to run a phonegap application. When I take
Hi I have android galaxy S (os 2.3.3 ) that is not nfc enable

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.