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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:36:31+00:00 2026-05-18T07:36:31+00:00

I created a bitmap and now i want to save that bitmap to a

  • 0

I created a bitmap and now i want to save that bitmap to a directory somewhere. Can anyone show me how this is done. Thanks

FileInputStream in;
          BufferedInputStream buf;
           try {
                  in = new FileInputStream("/mnt/sdcard/dcim/Camera/2010-11-16_18-57-18_989.jpg");
                  buf = new BufferedInputStream(in);
                  Bitmap _bitmapPreScale = BitmapFactory.decodeStream(buf);
                  int oldWidth = _bitmapPreScale.getWidth();
                  int oldHeight = _bitmapPreScale.getHeight();
                  int newWidth = 2592; 
                  int newHeight = 1936;

                  float scaleWidth = ((float) newWidth) / oldWidth;
                  float scaleHeight = ((float) newHeight) / oldHeight;

                  Matrix matrix = new Matrix();
               // resize the bit map
                  matrix.postScale(scaleWidth, scaleHeight);
                  Bitmap _bitmapScaled = Bitmap.createBitmap(_bitmapPreScale, 0, 0,  oldWidth, oldHeight, matrix, true);

(I want to save _bitmapScaled to a folder on my SD card)

  • 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-18T07:36:31+00:00Added an answer on May 18, 2026 at 7:36 am

    Hi You can write data to bytes and then create a file in sdcard folder with whatever name and extension you want and then write the bytes to that file.
    This will save bitmap to sdcard.

    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    _bitmapScaled.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
    
    //you can create a new file name "test.jpg" in sdcard folder.
    File f = new File(Environment.getExternalStorageDirectory()
                            + File.separator + "test.jpg");
    f.createNewFile();
    //write the bytes in file
    FileOutputStream fo = new FileOutputStream(f);
    fo.write(bytes.toByteArray());
    
    // remember close de FileOutput
    fo.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large bitmap (say 3888x2592) in a file. Now, I want to
Has anyone out there created a version of GDI32.dll that takes advantage of hardware
I have created a customized BasicEditField with Border using Bitmap.Now while typing the text,it
Since there is apparently no Flash control that can accept bitmap pastes , I
I want to save(export) contents of MyView, which extends TextView, into a bitmap. I
I have an ASP Image control that I want to save to a specific
i've created a bitmap with data and placed it into a sprite so to
I have a C++ DLL including bitmap resources created by Visual Studio. Though I
I want to create a PNG file from a System.Drawing.Bitmap with the colours defined
I have an ASP.NET web form. This web form has an event handler that

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.