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 4625268
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:14:51+00:00 2026-05-22T03:14:51+00:00

how can I save a Bitmap Image to the sdcard with loosing it’s original

  • 0

how can I save a Bitmap Image to the sdcard with loosing it’s original size or quality, I am currently using this code, but it always saves the image much smaller than the original size of the image captured by the camera.


private void SaveImage(Bitmap bitmap, String strType) {
        File sdImageMainDirectory = new File("/sdcard/");
        if (sdImageMainDirectory.exists()) {
            FileOutputStream fileOutputStream = null;
            Date dt = new Date();
            String nameFile = "myImage";
            int quality = 100;

        try {
            String strFullImageName;
            strFullImageName = UserID + "_" + nameFile + ".jpg";
            fileOutputStream = new FileOutputStream(
                    sdImageMainDirectory.toString() + "/"
                            + strFullImageName);
            BufferedOutputStream bos = new BufferedOutputStream(
                    fileOutputStream);
            bitmap.compress(CompressFormat.JPEG, quality, bos);
            bos.flush();
            bos.close();
            UploadImage(bitmap, strFullImageName, strType);
        } catch (FileNotFoundException e) {
            Utilities.LogError(e);
        } catch (IOException e) {
            Utilities.LogError(e);
        } catch (Exception eee) {
            Utilities.LogError(eee);
        }

    } else {
        Utilities.LogError("File not Found");
    }
}

Found the solution,

After following the link provided by KPBird, I found that the problem was in how the camera activity was returning the bitmap object captured.

To preserver memory, the camera activity returns a scaled image of the captured photo, so the solution was to never use this scaled image!

Just pass an extra to the camera intent, providing the url where you want to save the image and voilaa!, the captured photo is saved where you want it, with the original scale

Code:



private static final int CAMERA_PIC_REQUEST = 1337;

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

imageNameToUpload =  "myImage.jpeg";

cameraIntent.putExtra( android.provider.MediaStore.EXTRA_OUTPUT,        Uri.fromFile(new File(                  imagePathToUpload+imageNameToUpload)));
                                startActivityForResult(cameraIntent,
                                        CAMERA_PIC_REQUEST);

Thanks KPBird!

  • 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-22T03:14:52+00:00Added an answer on May 22, 2026 at 3:14 am

    Visit following link

    How do I save data from Camera to disk using MediaStore on Android?

    It may help

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

Sidebar

Related Questions

I am currently trying to save a bitmap image, but the background is changing
Consider this code for loading, modifying and saving a Bitmap image: using (Bitmap bmp
How can I save a bitmap object as an image to Amazon S3? I've
I'm using this code to convert a jpg image into a png 8. The
I'm trying to save a Layout into an Image in the SDCard but I
How can I draw text (with setting font and size) on image and save
I can save image to iPhone (iPhone Photo Albums \ Saved Photos) with UIImageWriteToSavedPhotosAlbum(image,
Internet Explorer can save its content as an MHTML file using the Save As...
When I call Bitmap.Save function, this error occurs: A generic error occurred in GDI+.
I was loading a Bitmap Image from a File. When I tried to save

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.