We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mozi/Mozi/Classes/Mozi.swift
发现2个严重 bug:
当处于第一区间时候,尺寸不仅没有缩小反而变大了,而鲁班算法会要求 n >= 1 等才会 * factor
let toSize = CGSize(width: self.size.width * factor, height: self.size.height * factor)
事实上已经计算了图片尺寸,不需要再乘以比例系数了
let toSize: CGSize if self.size.height > self.size.width { toSize = CGSize.init(width: size.width, height: size.height) } else { toSize = CGSize.init(width: size.height, height: size.width) }
老哥鲁班计算的是 kb, 而你没有* 1024,比较的是字节,99.9%的图片都跑到这里循环10遍,然后返回了 压缩系数 0.1 的值
while CGFloat(data.count) > size && compression > maxCompression {
乘以1024即可换算为 kb
while CGFloat(data.count) > size * 1024 && compression > maxCompression {
60多赞的都没发现嘛。老哥,代码没测好啊。。。
The text was updated successfully, but these errors were encountered:
还发现56行类型对应错误
if ratio > 0 && ratio <= 0.5 { // [1:2 ~ 1:∞) self = .rectangle(minValue: minV, maxValue: maxV) 之前对应的是 .square(minValue: minV, maxValue: maxV)
if ratio > 0 && ratio <= 0.5 { // [1:2 ~ 1:∞) self = .rectangle(minValue: minV, maxValue: maxV)
Sorry, something went wrong.
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Mozi/Mozi/Classes/Mozi.swift
发现2个严重 bug:
当处于第一区间时候,尺寸不仅没有缩小反而变大了,而鲁班算法会要求 n >= 1 等才会 * factor
let toSize = CGSize(width: self.size.width * factor, height: self.size.height * factor)
事实上已经计算了图片尺寸,不需要再乘以比例系数了
let toSize: CGSize if self.size.height > self.size.width { toSize = CGSize.init(width: size.width, height: size.height) } else { toSize = CGSize.init(width: size.height, height: size.width) }
老哥鲁班计算的是 kb, 而你没有* 1024,比较的是字节,99.9%的图片都跑到这里循环10遍,然后返回了 压缩系数 0.1 的值
while CGFloat(data.count) > size && compression > maxCompression {
乘以1024即可换算为 kb
while CGFloat(data.count) > size * 1024 && compression > maxCompression {
60多赞的都没发现嘛。老哥,代码没测好啊。。。
The text was updated successfully, but these errors were encountered: