您必須在使用getBitmap()函數之前調整編碼圖像的大小。首先構建你的EncodedImage,然後使用重新調整了下列文件:
private static EncodedImage rescaleEncodedImage (EncodedImage image, int width, int height) {
EncodedImage result = null;
try {
int currentWidthFixed32 = Fixed32.toFP(image.getWidth());
int currentHeightFixed32 = Fixed32.toFP(image.getHeight());
int requiredWidthFixed32 = Fixed32.toFP(width);
int requiredHeightFixed32 = Fixed32.toFP(height);
int scaleXFixed32 = Fixed32.div(currentWidthFixed32, requiredWidthFixed32);
int scaleYFixed32 = Fixed32.div(currentHeightFixed32, requiredHeightFixed32);
result = image.scaleImage32(scaleXFixed32, scaleYFixed32);
}
catch (Exception ex) {
}
return result;
}
然後調整從它
得到位圖後