简体   繁体   English

使用UIGraphicsImageRenderer渲染完整尺寸的图像

[英]Rendering a full sized image with UIGraphicsImageRenderer

Images taken with our device camera's are larger than the screen on our iOS device. 用我们的设备相机拍摄的图像大于我们的iOS设备上的屏幕。 Usually when we render an image in iOS i see people setting their rendering size to the size of the main view or their image view. 通常,当我们在iOS中渲染图像时,我会看到人们将其渲染大小设置为主视图或图像视图的大小。

As shown in this stack overflow response . 该堆栈溢出响应所示

Doing so will make the image smaller and lower quality. 这样做会使图像变小并降低质量。

If the logic follows. 如果遵循逻辑。

Would it be possible to render the image with it's full size if I make the image view go beyond the device screen. 如果我使图像视图超出设备屏幕,是否可以渲染完整尺寸的图像。 In other words the image view will be set to the size of the original full sized image. 换句话说,图像视图将被设置为原始全尺寸图像的大小。

Will doing this generate a rendered image with the same pixel size of the original image ? 这样会生成具有与原始图像相同像素大小的渲染图像吗?


What have I done so far ? 到目前为止,我做了什么? I have tested other image overlaying/editing apps and they seem to reduce the image's pixel size. 我已经测试了其他图像叠加/编辑应用程序,它们似乎减小了图像的像素大小。 I used the methods provided in the link above and they also do the same. 我使用了上面链接中提供的方法,它们也相同。

Yes it's definitely possible by embedding a UIImageView in a UIScrollView and using sizeToFit : 是的,通过将UIImageView嵌入UIScrollView并使用sizeToFit绝对有可能:

imageView.image = image;
[imageView sizeToFit]; 
scrollView.contentSize = image.size;

You will then be able to pan across the image within the scroll view. 然后,您将可以在滚动视图中平移图像。

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

相关问题 UIGraphicsImageRenderer:灰度图像的pngData - UIGraphicsImageRenderer: pngData for grayscale image UIGraphicsImageRenderer 生成 PPI 不正确的图像 - UIGraphicsImageRenderer produces image with incorrect PPI UIGraphicsImageRenderer 应用过滤器后镜像图像 - UIGraphicsImageRenderer mirrors image after applying filter 在后台线程中缩放图像崩溃 - UIGraphicsImageRenderer - Scaling image in background thread crashes - UIGraphicsImageRenderer 放置完整尺寸的图像以适合CALayer的整个屏幕 - Place a full sized image to fit the entire screen in a CALayer UIView使用UIGraphicsImageRenderer错误地使用alpha渲染图像 - UIView to UIImage using UIGraphicsImageRenderer wrongly renderer image with alpha 为什么用 UIGraphicsImageRenderer 绘制图像时大量使用 memory? - Why use a lot of memory when drawing image with UIGraphicsImageRenderer? 在某些情况下,当从扩展中调用时,UIGraphicsImageRenderer 闭包不会完成并返回图像 - UIGraphicsImageRenderer closure doesn't complete and return an image in some cases when invoked from within an extension 如何对UIGraphicsImageRenderer使用UIGraphicsRendererFormat? - How to use UIGraphicsRendererFormat for UIGraphicsImageRenderer? 在 UIGraphicsImageRenderer 中添加 UIImage - Add UIImage in a UIGraphicsImageRenderer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM