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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:30:21+00:00 2026-06-12T13:30:21+00:00

I am making a camera application. And I have to save the images after

  • 0

I am making a camera application. And I have to save the images after camera click on to server and as the size of the image captured is very large always ( in Mb’s) . So it is always dificult for me to save the large sized image on the server. Is there any to compress the image before saving it.??

And I have to only use android native camera

Thanks

  • 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-12T13:30:22+00:00Added an answer on June 12, 2026 at 1:30 pm

    Another approach would be to directly make smaller pictures. The advantage would be that you use less memory, but you might need a big picture in another part of your app.

    This can be done as follows:

    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height){
    ...
       Camera.Parameters mParameters = mCamera.getParameters();
       List<Size> sizes = mParameters.getSupportedPictureSizes();
       Size optimalSize = getOptimalSize(sizes, width, height);
       if (optimalSize != null && !mParameters.getPictureSize().equals(optimalSize))
            mParameters.setPictureSize(optimalSize.width, optimalSize.height);
    ...
    }  
    

    To choose the optimal size, you can use any criteria you want. I tried to make it as close as possible to the screen size:

     private Size getOptimalSize(List<Size> sizes, int w, int h){
    
        final double ASPECT_TOLERANCE = 0.05;
        double targetRatio = (double) w / h;
        if (sizes == null)
            return null;
    
        Size optimalSize = null;
        double minDiff = Double.MAX_VALUE;
    
        int targetHeight = h;
    
        for (Size size: sizes)
        {
            double ratio = (double) size.width / size.height;
            if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE)
                continue;
            if (Math.abs(size.height - targetHeight) < minDiff)
            {
                optimalSize = size;
                minDiff = Math.abs(size.height - targetHeight);
            }
        }
    
        if (optimalSize == null)
        {
            minDiff = Double.MAX_VALUE;
            for (Size size: sizes)
            {
                if (Math.abs(size.height - targetHeight) < minDiff)
                {
                    optimalSize = size;
                    minDiff = Math.abs(size.height - targetHeight);
                }
            }
        }
    
        return optimalSize;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an android application, which takes an image from camera and then
My application lets the user save/load images with alpha values to the camera roll
I am making an application which takes image from the camera and then email
In my application i have to upload mutiple images to server using php. i
I'm making an application that draws shapes and I use a camera to draw
I am making an object tracking application. I have used Emgucv 2.1.0.0 to load
I have an application which makes use of the default camera to take pictures
We are making an application and in it, we want the ability to save
I am making an application in which i am getting an Mjpg Images from
I'm making a virtual reality application where the camera should detect faces, locate them

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.