`BitmapFactory.decodeStream` with `inJustDecodeBounds=true` always return 100x100

This is my android code:

InputStream input = getAssets().open("photo.jpg");
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(input, null, options);
System.out.println("### img size: " + options.outWidth + "x" + options.outHeight);

But I found no matter how big of my image, it always print:

### img size: 100x100

Where is wrong?


It works fine after I re-deploying my application, but I modified nothing. It's strange but I want to keep this question here, maybe it will appear someday again.


//Read Bitmap Dimensions and Type

BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.myimage, options);
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
String imageType = options.outMimeType;

Ref here:

//you didn't assigned object name

InputStream input = getAssets().open("photo.jpg");

The BitmapFactory class provides several decoding methods (decodeByteArray(), decodeFile(), decodeResource(), etc.) for creating a Bitmap from various sources.

Need Your Help

Why returning (null) from MPMediaPicker (iOS)

ios objective-c

I am programming to get the iPhone music library to display, the user selects a song, then this song title is reflected in a UILabel. If only it was that simple! I have tried getting the MPMediaIte...

How do I acquire DELETE permissions on Facebook Graph API (PHP SDK)?

facebook facebook-graph-api permissions

Simple, imagine I am posting a wall post or an event on a random Facebook Page from a PHP script, and I want to delete the item. I simply use this :

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.