compressorjs icon indicating copy to clipboard operation
compressorjs copied to clipboard

IOS无法压缩JPG格式的图

Open fandaxia8 opened this issue 11 months ago • 5 comments

图像大小为18M, 参数为quality: 0.6, convertTypes: ["*"], convertSize: 10000000,同样一张图安卓是没问题的

fandaxia8 avatar Mar 20 '24 08:03 fandaxia8

可能是超出 iOS 内存限制,试试将 checkOrientation 属性设为 false

fengyuanchen avatar Apr 08 '24 07:04 fengyuanchen

我设置了 { strict: true, checkOrientation: false, quality: 0.6, convertTypes: ["image/png", "image/webp"], convertSize: 3000000, } jpeg格式的图片,ios还是无法压缩图片,安卓是可以的; 苹果拍照上传的图片是heif格式的没有这个问题

csfnb avatar Apr 30 '24 02:04 csfnb

估计还是浏览器内存上限问题,实在不行,可以考虑上传到服务端进行压缩。

fengyuanchen avatar May 04 '24 08:05 fengyuanchen

我测试了下,同一个 27.4M 的 jpg 图片,使用 https://donaldcwl.github.io/browser-image-compression/example/basic.html 是可以正常压缩的。可能不是内存问题?

xiaweiss avatar Aug 28 '24 04:08 xiaweiss

@fengyuanchen 是浏览器 canvas 有个宽高限制。 ios 只有 4096 x 4096,图片宽高超了时,就无法正常 draw。

xiaweiss avatar Aug 28 '24 06:08 xiaweiss

@xiaweiss 文档 maxWidth 参数有最大 4096 提示:https://github.com/fengyuanchen/compressorjs?tab=readme-ov-file#maxwidth

fengyuanchen avatar Sep 01 '24 07:09 fengyuanchen