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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:33:37+00:00 2026-06-07T06:33:37+00:00

In my application I’m using the ACTION_IMAGE_CAPTURE Intent to get a picture taken. When

  • 0

In my application I’m using the ACTION_IMAGE_CAPTURE Intent to get a picture taken. When the camera returns, the file is checked and if the rotation is portrait a the bitmap is rotated and saved out to disk with the following code:

BitmapFactory.Options options = new Options();
options.inPreferredConfig = Bitmap.Config.RGB_565;
Bitmap bmp = BitmapFactory.decodeFile(f.getAbsolutePath(), options);
if (bmp != null) {
    Matrix m = new Matrix();
    m.postRotate(90);
    Bitmap rotated = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), m,
                                        true);
    rotated = rotated.copy(Bitmap.Config.RGB_565, false); // added based on comment
    f.delete();
    FileOutputStream fos = new FileOutputStream(f);
    rotated.compress(Bitmap.CompressFormat.JPEG, 100, fos);
    fos.close();
}

This works as it should, but the file size is twice that of non-rotated picture. I’ve tried setting the densities on the BitmapFactory.Options to 0 and the scale to false, but neither is having the desired effect. I want the image I transform to be the same size as the image I load from disk. Is there something in my code that is preventing this from happening?

  • 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-07T06:33:39+00:00Added an answer on June 7, 2026 at 6:33 am

    Your original JPEG uses RGB565, which uses 2 bytes per pixel. Your in-memory bitmap derived from this file uses the “normal” format with 4 bytes per pixel; when this is saved to a new JPEG, it’s saved with the denser format and thus is twice the size (this has nothing to do with its being rotated).

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

Sidebar

Related Questions

Application is running in my local system app.config file <add key=dbconn value=Data Source=(local);database=VTech;User ID=sa;Password=sa;
Application stores configuration data in custom section of configuration file. This information is used
The application I'm currently writing is using MVVM with the ViewModel-first pattern. I have
my application use 10 threads that to read a lot of html file.similar the
Application flow An input file consists of multiple logical documents. Extract one input logical
My application ( main.exe ) is executing a Child process ( child.exe ) using
Application is sending email by using MFMailComposeViewController , everything works just fine. However after
Application db connection in web service. i haveto connect the db using that web
Application.Run MyWorkBook.xls!Macro1 will work (run the macro called Macro1 in the MyWorkBook.xls file). Application.Run
Application was built using MS interop, to export .xls to infoPath and vice versa.

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.