private void compressQuality(File outFile, long maxSize, int maxQuality) throws IOException {
        long length = outFile.length();
        int quality = 90;
        if (length > maxSize) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            BoxingLog.d("source file size : " + outFile.length() + ",path : " + outFile);
            while (true) {
                compressPhotoByQuality(outFile, bos, quality);
                long size = bos.size();
                BoxingLog.d("compressed file size : " + size);
                if (quality <= maxQuality) {
                    break;
                }
                if (size < maxSize) {
                    break;
                } else {
                    quality -= 10;
                    bos.reset();
                }
            }
            OutputStream fos = new FileOutputStream(outFile);
            bos.writeTo(fos);
            bos.flush();
            fos.close();
            bos.close();
        }
    }
@param width  must > 0
@param height must > 0
boxing/src/main/java/com/bilibili/boxing/utils/ImageCompressor.java