如何在Android中查找任何圖像的分辨率。 請建議,謝謝。如何在Android/Java中獲取圖像的解析度?
1
A
回答
3
你可以使用這樣的事情,如果你的形象在你的RES /繪製
Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.back);
bmp.getWidth(), bmp.getHeight();
0
我想你可以使用methodes:
myImageBitmap.getWidth();
myImageBitmap.getHeight();
2
你一定要學會如何短語的問題!既然你沒有提供任何信息,我只能猜測你在做什麼。也許你可以試試這個...
ImageView iv = new ImageView(this);
iv.getDrawable().getIntrinsicWidth();
iv.getDrawable().getIntrinsicHeight();
6
高效的方式來獲得圖像的大小存儲在磁盤(例如,獲取用戶選擇的上傳圖片文件的大小)是使用BitmapFactory.Options
並將inJustDecodeBounds
設置爲true。通過這樣做,您將獲得圖像文件的大小(寬度和高度),而不會將整個圖像加載到內存中。這將有助於在上傳前檢查圖像的分辨率。
String pickedImagePath = "path/of/the/selected/file";
BitmapFactory.Options bitMapOption=new BitmapFactory.Options();
bitMapOption.inJustDecodeBounds=true;
BitmapFactory.decodeFile(pickedImagePath, bitMapOption);
int imageWidth=bitMapOption.outWidth;
int imageHeight=bitMapOption.outHeight;
2
我覺得你正在尋找這...
bitmap=MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
int imageWidth=bitmap.getWidth();
int imageHeight=bitmap.getHeight();
嘗試使用這個,讓我知道
相關問題
- 1. 如何從jquery json解析中獲取圖像大小?
- 2. JSON解析器獲取圖像
- 3. 獲取地圖解析映像
- 4. 解析JSON鏈接以獲取圖像
- 5. 解析圖像以獲取信息
- 6. 如何在Symfony2中解析獲取url?
- 7. 如何在OpenCV中獲取圖像寬度和高度?
- 8. 如何在uiimagepickercontroller中用圖像寫入/獲取緯度經度?
- 9. 在jquery中獲取xml屬性進行圖像解析
- 10. ANDROID:從解析圖像獲取Android圖像
- 11. 如何獲取灰度圖像中的像素值
- 12. JSON解析並獲取android中的圖像
- 13. 如何從網絡中獲取圖像寬度和高度url
- 14. 如何在圖像地圖鼠標中獲取圖像的ID
- 15. 獲取圖像的寬度和高度
- 16. 獲取圖像的寬度和高度
- 17. 獲取圖像的寬度和高度
- 18. 如何使用YUV圖像獲取灰度圖像Pygame
- 19. 如何從灰度圖像中獲取像素的灰度值xCode
- 20. MeteorJS獲取圖像寬度
- 21. 如何解析非常大的圖像?
- 22. 如何獲取圖像的圖像高度以設置另一個div高度
- 23. 如何在javascript中獲取圖像源?
- 24. 如何獲取圖像控件的寬度和高度
- 25. onhover如何使用jquery獲取圖像的寬度和高度
- 26. 如何獲取圖像的寬度和高度?
- 27. 如何獲取圖像的寬度和高度?
- 28. 圖像的抓取/解析URL
- 29. 解析JSON並提取圖像的URL
- 30. 從分析/ Android中獲取圖像
你的意思是分辨率(每英寸像素)或尺寸(寬度和高度)? – Guffa 2011-05-23 15:16:51
嗨Guffa,是的,它是關於「每英寸像素」。 – CoDe 2011-05-24 07:50:48