LFImagePickerController icon indicating copy to clipboard operation
LFImagePickerController copied to clipboard

标清图过度压缩

Open halfpreschooler opened this issue 5 years ago • 3 comments

  • (NSData *)lf_fastestCompressImageDataWithSize:(CGFloat)size imageSize:(NSUInteger)imageSize;

标清图 建议支持传入最大尺寸做初步压缩 或者 最大压缩次数防止消耗太大

    /** 缩放图片 */
    if (currentResolution > MIN_UPLOAD_RESOLUTION) {
        float factor = sqrt(currentResolution / MIN_UPLOAD_RESOLUTION) * 2;
        compressedImage = [self lf_scaleWithSize:CGSizeMake(self.size.width / factor, self.size.height / factor)];
    }
    
    percent *= (targetSize/imageLength);

这一步压缩过度 且 压缩后没有检测是否已经符合要求

halfpreschooler avatar Apr 02 '21 02:04 halfpreschooler

是的。这里很有很大优化空间。当初设计是最快返回100k 和10k 的图片。若要适配任意大小需要涉及一些图片计算公式。

发自我的iPhone

在 2021年4月2日,10:44,李浪 @.***> 写道:

 (NSData *)lf_fastestCompressImageDataWithSize:(CGFloat)size imageSize:(NSUInteger)imageSize; 标清图 建议支持传入最大尺寸做初步压缩 或者 最大压缩次数防止消耗太大

/** 缩放图片 */
if (currentResolution > MIN_UPLOAD_RESOLUTION) {
    float factor = sqrt(currentResolution / MIN_UPLOAD_RESOLUTION) * 2;
    compressedImage = [self lf_scaleWithSize:CGSizeMake(self.size.width / factor, self.size.height / factor)];
}

percent *= (targetSize/imageLength);

这一步压缩过度 且 压缩后没有检测是否已经符合要求

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

lincf0912 avatar Apr 02 '21 03:04 lincf0912

请问如何解决标清图过渡压缩这个问题,大佬有给出解决办法么? 谢谢

wuWeiFeng2 avatar Apr 29 '21 03:04 wuWeiFeng2

选原图。然后在回调时自己压缩。 这个是 时间、准确率、内存消耗。很难找到都认同的平衡点。

发自我的iPhone

在 2021年4月29日,11:50,wuWeiFeng2 @.***> 写道:

 请问如何解决标清图过渡压缩这个问题,大佬有给出解决办法么? 谢谢

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

lincf0912 avatar Apr 29 '21 03:04 lincf0912