我已经在图像视图中设置了缩放图像。现在我想要得到缩放图像的路径。这有可能吗?我听说它存储在内存中的某个地方。
更新:
我有这个问题:我在imagview中设置了一个图库中的图像。我现在想要的是保存这个状态(这意味着图像视图中的图像)。我该怎么做呢?
我想用blob将整个图像保存到我的SQL数据库中。但后来我听说应该更多地采用图像路径。
有人能告诉我怎么做吗?
这就是我如何从图库中获取图像以及如何在我的ImageView中设置它。
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PICK_FROM_FILE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Log.v("IMAGE PATH====>>>> ",selectedImagePath);
// Decode, scale and set the image.
Bitmap myBitmap = BitmapFactory.decodeFile(selectedImagePath);
Bitmap scaledBitmap = Bitmap.createScaledBitmap(myBitmap, NEW_WIDTH, NEW_HEIGHT, true);
myBitmap.recycle();
myBitmap = null;
mImageView.setImageBitmap(scaledBitmap);
}
}
}发布于 2012-06-04 23:35:37
尝尝这个
String filename = "myfilename"
FileOutputStream out = new FileOutputStream(filename)
scaledBitmap.compress(Bitmap.CompressFormat.PNG, 90, out);这里有更多关于如何保存BitMap对象here的例子。
https://stackoverflow.com/questions/10883676
复制相似问题