如何获取以英寸或UIImage分辨率为单位的UIImage大小? [英] How to get UIImage size in inches or UIImage resolution?

查看:126
本文介绍了如何获取以英寸或UIImage分辨率为单位的UIImage大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想压缩图像并上传到服务器.这种压缩应取决于图像大小.或者,如果我们在iPhone中使用任何API来获取图像分辨率,也将有所帮助,以便基于此分辨率,我可以设置压缩率.

I want to compress my image and upload to server. This compression should be depended on the image size. Or it would help if we have any API in iPhone to get image resolution so that based on this resolution, i can set the compression rate.

感谢Jithen

推荐答案

iOS SDK中没有任何东西可以让您从给定像素开始以英寸为单位的图像大小,一种选择是为您的图像对象计算尺寸(以英寸为单位).

There is nothing in iOS SDK to give you image size in inches from given pixel, one option is to determine on which device your app is running and then calculate size in inches for you image object.

这篇关于如何获取以英寸或UIImage分辨率为单位的UIImage大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆