private void compressPhotoByQuality(File file, final OutputStream os, final int quality) throws IOException, OutOfMemoryError {
        BoxingLog.d("start compress quality... ");
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inPreferredConfig = Bitmap.Config.RGB_565;
        Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath(), options);
        if (bitmap != null) {
            bitmap.compress(Bitmap.CompressFormat.JPEG, quality, os);
            bitmap.recycle();
        } else {
            throw new NullPointerException("bitmap is null when compress by quality");
        }
    }
@param width  must > 0
@param height must > 0
boxing/src/main/java/com/bilibili/boxing/utils/ImageCompressor.java