有没有任何参考教程在中小环境下获取图像大小。UIImage UIImage小+中+大如苹果邮件
我只是想知道在宽度和高度方面的图像大小的计算,我们如何计算UIImage像素大小时,它像苹果电子邮件中的小,中等或大。
当我们重视形象邮件,它要求小,中,大吗,就像..
PLZ不提前提供this因为我已经通过这个走了..
感谢。
有没有任何参考教程在中小环境下获取图像大小。UIImage UIImage小+中+大如苹果邮件
我只是想知道在宽度和高度方面的图像大小的计算,我们如何计算UIImage像素大小时,它像苹果电子邮件中的小,中等或大。
当我们重视形象邮件,它要求小,中,大吗,就像..
PLZ不提前提供this因为我已经通过这个走了..
感谢。
许多解决方案,终于看到我得到了以下的解决方案,并做了根据代码这个。
我们可以得到如下图像。
Small = 320 pixels on longest edge JPEG
Medium = 640 pixels on longest edge JPEG
Large = 1296 pixels on longest edge JPEG
其中typeOfImage = 0,1,2分别为小,中,大。
-(CGSize)getImageWithRespectiveSize:(UIImage *)pImage withType:(NSInteger)typeOfImg
{
CGSize pSize;
if(typeOfImg == 0)
pSize = [self getCGSizesOfImages:320 andImage:pImage];
else if(typeOfImg == 1)
pSize = [self getCGSizesOfImages:640 andImage:pImage];
else if(typeOfImg == 2)
pSize = [self getCGSizesOfImages:1296 andImage:pImage];
else
pSize = CGSizeMake(pImage.size.width, pImage.size.height);
return pSize;
}
-(CGSize)getCGSizesOfImages:(NSInteger)pIntPixels andImage:(UIImage *)pImage
{
CGSize pSize;
if(pImage.size.width > pImage.size.height)
{
CGFloat tmp = pImage.size.height/pImage.size.width*pIntPixels;
pSize = CGSizeMake(pIntPixels, tmp);
}
else if(pImage.size.width < pImage.size.height)
{
CGFloat tmp = pImage.size.width/pImage.size.height*pIntPixels;
pSize = CGSizeMake(tmp, pIntPixels);
}
else
{
CGFloat tmp = pImage.size.height/pImage.size.width*pIntPixels;
pSize = CGSizeMake(tmp, pIntPixels);
}
return pSize;
}
和打电话的时候,我们重视形象邮件,它要求小型,中型,大型..这种选择这样
CGSize size = [self getImageWithRespectiveSize:imgOriginal withType:0];
您可以使用imageIO框架,设置调整图像大小的方法非常简单。这里有大量的样本,这是谷歌的第一次打击,它也解释了核心图形的经典方式。 uiimage scaling
[编辑]
如果您正在寻找如何让大小的字节数,你可以看看这个示例代码从苹果Large Image Downsizing
一样发挥作用?我也在寻找这个解决方案。 – 2012-04-02 05:43:54
@anonymous是的,亲爱的只看那个 – 2012-04-02 05:45:41
嗯。我将收藏这个问题.. – 2012-04-02 05:46:14