WebP快速压缩

时间:2019-02-27 08:55:35

标签: android webp

我想使用WebP格式,因为它可以很好地压缩(编码)图像(高质量和小尺寸)

但是在Android上,将位图压缩到WebP的下一种方法运行得很慢

使用Snapdragon 625的设备上分辨率为640x360的位图为130-140毫秒

val stream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.WEBP, 40, stream)
val webpBytes = stream.toByteArray()

Android上是否有更快的方法将相机中的Bitmap或原始帧(NV12转换为压缩的WebP图像?是第三方库吗?

我尝试过OpenCV,它的运行速度更快(100-107),但还不够

MatOfInt params = new MatOfInt(Imgcodecs.IMWRITE_WEBP_QUALITY, 10);
MatOfByte matOfByte = new MatOfByte();
Imgcodecs.imencode(".webp", mat, matOfByte, params);
byte[] webpBytes = matOfByte.toArray();

0 个答案:

没有答案