本文介绍了如何将所有图像格式转换为.png格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个小型应用程序,我从Web服务接收图像。我正在获取图片网址。并且图像的格式不同,如.jpg,.gif,.png等。我想将这些图像保存到我的沙箱中,然后将其显示到图像视图中。

I am making a small application where I am receiving images from web-service. I am getting the image url. And the format of images is different different like .jpg,.gif,.png etc. And I want to save these images into my sandbox and later on show it into image view.

要做到这一点,我给自己的名字并将扩展名扩展为.png。但是在检索时会显示.png图像,但不会显示不同的图像。那么你能告诉我如何将所有图像转换为.png格式或任何其他方法来做到这一点吗?

To do this I am giving a self name and gave the extension to .png. But at the time of retrieving the .png images are shown but different one's are not shown. So can you give me any idea how to convert all images to .png format or any other approach to do this?

推荐答案

你检索你的图像/网址以这种方式保存:

after you retrieve your images/url save them this way:

NSData *imageData = UIImagePNGRepresentation(image);
[imageData writeToFile:savedImagePath atomically:YES];

这篇关于如何将所有图像格式转换为.png格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 09:35
查看更多