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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:42:21+00:00 2026-05-26T21:42:21+00:00

I have a jpg image in my android application drawable folder which resolution is

  • 0

I have a jpg image in my android application drawable folder which resolution is 1000×600.
I load that image to bitmap like this

 Bitmap bitMap = BitmapFactory.decodeResource(getResources(), R.drawable.image);

After this I call bitMap .getWidth() which returns 1500. How it can be? And how to get the right width and height of image?

  • 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-26T21:42:21+00:00Added an answer on May 26, 2026 at 9:42 pm

    This is probably because of differing densities. Your resource is probably stored in a medium density folder, but your device is hdpi. Medium density is 160dpi, high density is 240dpi. Thus your bitmap is scaled to 1.5x the size it was originally. See the document on multiple screens for more info.

    If resources are not available in the correct density, the system loads the default resources and scales them up or down as needed to match the current screen’s density.

    If you intended this to be for high density put it in drawable-hdpi instead of drawable or drawable-mdpi.

    Update:

    If you want it to ignore density, put it in a drawable-nodpi folder. Also from the same doc:

    The easiest way to avoid pre-scaling is to put the resource in a resource directory with the nodpi configuration qualifier. For example:

    res/drawable-nodpi/icon.png
    

    When the system uses the icon.png bitmap from this folder, it does not scale it based on the current device density.

    You can also see here for more information on providing and grouping resources.

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

Sidebar

Related Questions

I have a CSS entry that looks like this: .header { background-image: url(./images/embouchure.jpg); background-repeat:
I have written an application in which I want to convert a .jpg image
Problem Hello all! I have this code which takes my jpg image loops through
I have generated JPG image, saved to Documents folder, that not comes with bundle.
In my \drawable-mdpi folder, I have an image named: test.jpg In my main.xml file,
I have a asp image control. ImageUrl=images/avator.jpg. I'm changing this picture on the server
I have one image submit button like this <input id=enter name=enter type=image value=Login src=images/btn_login.jpg/>
Suppose I have this image: <img src=images/01.jpg border=0 rel=shadow /> Then with jQuery, I
I have an AppEngine application that uses the blobstore to store user-provided image data.
I want to add a spinner to my android application that looks like 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.