UIImageJPEGRepresentation compressionQuality vs other encoders

若如初见. 提交于 2019-12-08 13:50:30

问题


How does the compressionQuality parameter in UIImageJPEGRepresentation related to similar parameters in other encoders such as libjpeg or ImageMagick?

When I try to use the same values in both ImageMagick and UIImageJPEGRepresentation I get totally different images sizes. I even tried WebP and it's size is much smaller that the UIImageJPEGRepresentation result.


回答1:


You are likely to get smaller image sizes with ImageMagick because it is a desktop program that can utilize the higher computing power to give you better compression without sacrificing too much image quality. If you want smaller sizes in UIImageJPEGRepresentation, you will have to lower the quality parameter:

UIImageJPEGRepresentation(img, 0.5)];

WebP is a completely different, and much newer compressed image format, so it is likely to product smaller files as well. If size is so much of a concern, you will also see huge size decreases if you can scale down the image before converting it to JPEG.



来源:https://stackoverflow.com/questions/25293972/uiimagejpegrepresentation-compressionquality-vs-other-encoders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!