简体   繁体   English

iPhone - 以更高的分辨率保存图像,无需像素化

[英]iPhone - save image at higher resolution without pixelating it

I am using the image picker controller to get an image from the user. 我正在使用图像选择器控制器从用户获取图像。 After some operations on the image, I want the user to be able to save the image at 1600x1200 px, 1024x1024 px or 640x480 px (something like iFlashReady app). 在对图像进行一些操作之后,我希望用户能够以1600x1200像素,1024x1024像素或640x480像素(类似于iFlashReady应用程序)保存图像。

The last option is the size of image I get in the UIImagePickerControllerDelegate method (when using image from camera roll) 最后一个选项是我在UIImagePickerControllerDelegate方法中获得的图像大小(当使用来自相机胶卷的图像时)

Is there any way we can save the image at these resolutions without pixelating the images? 有没有什么办法可以保存这些分辨率的图像而不会像素化图像?

I tried creating a bitmap context with the width and height I want (CGBitmapContextCreate) and drawing the image there. 我尝试使用我想要的宽度和高度创建一个位图上下文(CGBitmapContextCreate)并在那里绘制图像。 But the image gets pixelated at 1600x1200. 但图像在1600x1200像素化。

Thanks 谢谢

This is non-trivial. 这不重要。 Your image just doesn't have enough data. 您的图片没有足够的数据。 To enlarge it you'll need to resample the image and interpolate between pixels (like photoshop when you resize an image). 要放大它,您需要重新采样图像并在像素之间进行插值(如调整图像大小时的photoshop)。

Most likely you'll want to use a 3rd party library such as: 您很可能想要使用第三方库,例如:

http://code.google.com/p/simple-iphone-image-processing/ http://code.google.com/p/simple-iphone-image-processing/

This performs this and many other image processing functions. 这执行了此功能和许多其他图像处理功能。

Before drawing try adjusting your CGBitmapContext's antialiasing and/or interpolation quality: 在绘制之前尝试调整CGBitmapContext的抗锯齿和/或插值质量:

CGContextSetShouldAntialias( context, 1 == 1 )

CGContextSetInterpolationQuality( context, kCGInterpolationHigh ) ;

If I remember right, antialiasing is turned off on CGContext by default. 如果我没记错的话,默认情况下会在CGContext上关闭抗锯齿功能。

从很久以前的计算机视觉类的微弱记忆中,我认为你所做的是在上变换后模糊图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM