保存图像后,我的图像显得很小并且在画布内部也显得模糊并显示黑色背景。任何人都可以告诉我为什么?
Bitmap mBackground = Bitmap.createBitmap(myBitmap.getWidth() ,myBitmap.getHeight(),myBitmap.getConfig());
mCanvas = new Canvas(mBackground);
//mCanvas.drawBitmap(mBackImage, (mCanvas.getWidth() / 2), 0, null);
mCanvas.drawBitmap(myBitmap ,mCanvas.getWidth(),mCanvas.getHeight(), null);
mCanvas.drawBitmap(myBitmap1,x-dx,y-dy, null);
try
{
mBitmapDrawable = new BitmapDrawable(mBackground);
Bitmap mNewSaving = mBitmapDrawable .getBitmap();
String ftoSave = mTempDir + mSaveImageName;
File mFile = new File(ftoSave);
Random generator = new Random();
int n = 10000;
n = generator.nextInt(n);
FileOutputStream out = new FileOutputStream(mFile);
mNewSaving.compress(CompressFormat.JPEG,0, out);
Toast.makeText(getApplicationContext(), "Image Saved",Toast.LENGTH_SHORT).show();
out.flush();
out.close();
}
答案 0 :(得分:0)
在mNewSaving.compress(CompressFormat.JPEG,0, out);
中,第二个参数如下:
提示压缩机,0-100。 0表示压缩小尺寸,100 意味着压缩最高质量。有些格式,比如PNG 无损,将忽略质量设置
因此,如果你想要一个大图像,你应该把它100
mNewSaving.compress(CompressFormat.JPEG, 100, out);