• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Incorrect height and width of bitmap

manvinder

Newbie
Hi all,

I am using following code to get the Bitmap

Code:
try {
			Log.e("src", imageURL);
			URL url = new URL(imageURL);
			// Create an http connection
			HttpURLConnection connection = (HttpURLConnection) url.openConnection();
			connection.setDoInput(true);
			connection.connect();
			InputStream input = connection.getInputStream();
			
			BitmapFactory.Options options = new BitmapFactory.Options();
			
			
			Bitmap myBitmap = BitmapFactory.decodeStream(input);
			Log.d("SPen", "Bitmap height: " + myBitmap.getHeight() + ", Weight: " + myBitmap.getWidth());
		} catch (IOException e) {
			e.printStackTrace();
			Log.d("Exception", e.getMessage());
		}

I am getting the height and width of the Bitmap as 683 and 323. but the actual size of image is 3507 and 2480. is there any problem in the code.
 
Is the bitmap scaled on the page you are taking it from? If it isn't full size on the page, then it won't be full size on the way in.
 
Back
Top Bottom