如何将UIImage保存为BMP? [英] How do I save an UIImage as BMP?

查看:141
本文介绍了如何将UIImage保存为BMP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在iPhone的文档目录中保存(写入文件) UIImage 对象作为位图文件(.bmp扩展名)吗?

Can I save (write to file) UIImage object as bitmap file (.bmp extension) in iPhone’s document directory?

提前致谢。

推荐答案

我不认为iPhone上支持BMP。也许有人为 UIImage 编写了一个保存到BMP中的类别,但我不知道。我想你必须从 UIImage 获取位图数据并自己编写,BMP是一种非常简单的文件格式。您所要做的就是写出标题然后写出未压缩的数据。标题是一个名为 BITMAPINFOHEADER 的结构,参见 MSDN 。 Apple的 UIImage 的位图数据rel =nofollow noreferrer>技术问答& A1509

I don’t think BMP is supported on iPhone. Maybe somebody wrote a category for UIImage that does saving into BMP, but I don’t know about any. I guess You’ll have to get the bitmap data from the UIImage and write them yourself, BMP is quite a simple file format. All you have to do is write out the header and then the uncompressed data. The header is a structure called BITMAPINFOHEADER, see MSDN. Getting the bitmap data of an UIImage is described in Apple’s Technical Q&A1509.

这篇关于如何将UIImage保存为BMP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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