image-conversion icon indicating copy to clipboard operation
image-conversion copied to clipboard

Image cannot be converted accurately to the size

Open enjoykcc456 opened this issue 3 years ago • 5 comments

Hi, thanks for the library. I have been trying to use the compressAccurately method to compress the image to certain size. However, when i am trying to compress an image of 3M, i set the config to {size: 100000, accuracy: 99} with same width and height as the original image. The image cannot be compressed to 100kb as wanted. It would end up be compressed image of around 300kb. Hence, would like to know what would be the reason of this. Thanks!

enjoykcc456 avatar Oct 13 '21 10:10 enjoykcc456

The default unit of size is kb

WangYuLue avatar Oct 22 '21 03:10 WangYuLue

Thanks for the reply. I think there is a typo in my previous comment. I meant to say i set the config to {size: 100, accuracy: 99} to compress the image accurately to 100kb. However, when i try to compress the image with size of around 2 to 3MB, the resulting image wont be accurately 100kb, but around 300kb.

enjoykcc456 avatar Oct 22 '21 03:10 enjoykcc456

Same here

munkk avatar Apr 28 '22 08:04 munkk

you have to reduce image dimensions to make it work ex. compressAccurately(file, {size: 100, width:800, height: 600})

munkk avatar Apr 28 '22 11:04 munkk

如果不想改变原始的长度和宽度怎么做

zhaoyuanmeng avatar Apr 08 '24 03:04 zhaoyuanmeng