【问题标题】:Perfect Image-Sizes for iPhone (Retina) using Cloudinary使用 Cloudinary 的 iPhone (Retina) 完美图像尺寸
【发布时间】:2015-05-24 11:16:56
【问题描述】:

从 Cloudinary(或其他 Picture-CDN)加载图像时,在视网膜显示器上的 UIImageView 中显示的正确图像大小是多少?

一方面,我有一个 Table,每个 TableCell 都有自己的 UIImageView,宽度和高度均为 70px。 另一方面,我用背景图像覆盖了整个屏幕的所有尺寸。 每张图片都是从 Cloudinary 加载的,我可以在其中为图片下载请求特定的图片尺寸。

由于 Retina-displays 需要原始图片的双倍尺寸(据我所知),我想我也必须向 Cloudinary 请求双倍尺寸的图像,不是吗?

因此,对于大小为 70x70 像素的 UIImageView,我会请求 140x140 像素的图像缩略图,而对于屏幕背景图像,我会请求 screenWidth * 2 和 screenHeight * 2 以从 Cloudinary 加载图像.

我错了还是我的假设正确?

【问题讨论】:

    标签: ios objective-c uiimageview cloudinary retina


    【解决方案1】:

    看到这个:https://github.com/cloudinary/cloudinary_ios
    网址中的具体图片尺寸:

    // 150 * 100
    http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill/sample.jpg
    // 250 * 300
    http://res.cloudinary.com/demo/image/upload/w_250,h_300,c_fill/sample.jpg
    

    或使用CLTransformation:

    CLTransformation *transformation = [CLTransformation transformation];
    [transformation setWidthWithInt: 100];
    [transformation setHeightWithInt: 150];
    [transformation setCrop: @"fill"];
    
    NSString *url = [cloudinary url:@"sample.jpg" options:@{@"transformation": transformation}];
    
    // http://res.cloudinary.com/n07t21i7/image/upload/c_fill,h_150,w_100/sample.jpg
    

    【讨论】:

    • 这不是我的问题的答案。我知道如何请求不同的图像尺寸。我的问题是:我应该选择双倍图像大小而不是 UIImageView 的大小,图片将放置在哪里?
    • 你是对的。图片会被 UIKit 适当地缩放,实际上是 UIImageView 会受到 Retina 显示的影响。
    • 另外,您可以使用 Cloudinary 的自动 DPR 检测和交付功能,而不是明确要求双倍大小的图像:cloudinary.com/blog/…
    猜你喜欢
    • 1970-01-01
    • 2016-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多