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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:38:55+00:00 2026-05-23T08:38:55+00:00

I have taken thumbnail image from gallery which is smaller in size and resized

  • 0

I have taken thumbnail image from gallery which is smaller in size and resized into 300*300 size.

By doing that the image looking so blurred.

getting image from gallery

 @Override
    protected void onActivityResult(int requestCode, int resultCode,
            Intent imageReturnedIntent) {
        super.onActivityResult(requestCode, resultCode, imageReturnedIntent);

        switch (requestCode) {
        case 0:
            if (resultCode == RESULT_OK) {
                try {
                    flag = 1;
                    Uri selectedImage = imageReturnedIntent.getData();
                    String[] filePathColumn = { MediaStore.Images.Media.DATA };

                    Cursor cursor = getContentResolver().query(selectedImage,
                            filePathColumn, null, null, null);
                    cursor.moveToFirst();

                    int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                    String filePath = cursor.getString(columnIndex); // file
                    // path
                    // of
                    // selected
                    // image
                    cursor.close();

                    // Convert file path into bitmap image using below line.

                    yourSelectedImage = download.getResizedBitmap(
                        image.decodeImage(filePath),270,228);

                    // put bitmapimage in your imageview
                    profile_image.setImageBitmap(
                            yourSelectedImage);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }

Image resizing

public  Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) 
    {
        try
        {
            if(bm!=null)
            {
            int width = bm.getWidth();
            int height = bm.getHeight();
            float scaleWidth = ((float) newWidth) / width;
            float scaleHeight = ((float) newHeight) / height;
            // create a matrix for the manipulation
            Matrix matrix = new Matrix();
            // resize the bit map
            matrix.postScale(scaleWidth, scaleHeight);
            // recreate the new Bitmap
            resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true); 


            }
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }

        return resizedBitmap;
    } 
  • 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-23T08:38:56+00:00Added an answer on May 23, 2026 at 8:38 am

    Images get blurred when you enlarge them (unless you are using an vector image and you are using a bitmap). Your getResizedBitmap method doesn’t do anything much other than stretching the image to fit the new size. The only way you are going to solve your problem is by selecting larger images (but then eventually you will run into the aspect ratio problem, so you should really rethink your scaling algorithm).

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

Sidebar

Related Questions

Both the thumbnail tooltip and the gallery image title are ofc taken from the
I have taken over a project that was build from suggestions in this Dan
I've got a larger slider image and a smaller thumbnail image. I have this
I'm trying to integrate CSS pagination into a thumbnail gallery I have set up
I have a large image in a gallery that needs to change when one
I have the php code below which help me get a photo's thumbnail image
I have a image thumbnail function that basically just re-sizes the image and outputs
I have the following code to take an image and generate the thumbnail. how
I have taken a manifest from one of the answers posted here in SO
I have taken following array; to fill-up gallery: private Integer[] mImageIds = { R.drawable.one,

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.