我使用以下代码进行图像压缩.
该代码压缩大于2 MB的图像文件.
但是这段代码需要时间和图像质量保持纯粹.
public static String compressImage(String imagePath, Context context)
{
String resizeImagePath = null;
String filePath = imagePath;
CustomLogHandler.printDebug(TAG, "resizeImagePath:" + imagePath);
Bitmap scaledBitmap = null;
int imageScal = 1;
// File size greater then 2mb
DecimalFormat df = new DecimalFormat("0.00");
File imgFile = new File(filePath);
double bytes = imgFile.length();
double kilobytes = (bytes / 1024);
double megabytes = (kilobytes / 1024);
AppConfig.makeLog(TAG, "image size in mb:" + df.format(megabytes), 0);
double filesize = Double.parseDouble(df.format(megabytes));
if (filesize > 2.00f) …Run Code Online (Sandbox Code Playgroud) 当我构建我的项目时,我得到了这个错误.
Serializing CDT Project settings has encountered a problem (Null Pointer Exception)
Run Code Online (Sandbox Code Playgroud)
我正在使用最新的eclipse并尝试为Android构建cocos2d-x3.2.