0

What would be the correct image size to display in an UIImageView on a retina display, when the image is loaded from Cloudinary (or another Picture-CDN)?

On the one hand, i have a Table and each TableCell has its own UIImageView with both 70px in width and height. On the other hand, i cover the whole screen in its all size with an Background-Image. Every image is loaded from Cloudinary, where i can request specific image sizes for the image-download.

Since Retina-displays needs the double size of the original picture (as far as i know), i guess, i have to request the double size of the images also from Cloudinary, isn't it?

So, for an UIImageView with a size of 70x70 Pixel, i would request the image-thumbnail with 140x140 Pixel, and for the Screen-Background-Image i would request screenWidth * 2 and screenHeight * 2 to load the image from Cloudinary.

Am i wrong or is my assumption right?

delete
  • 18,144
  • 15
  • 48
  • 79

1 Answers1

0

See this: https://github.com/cloudinary/cloudinary_ios
Specific image size in URL:

// 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

or use 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
Bannings
  • 10,376
  • 7
  • 44
  • 54
  • 1
    This is not an answer to my question. I know how to request different images sizes. My question is: should i pick up double image sizes instead of the size of the UIImageView, where the pictures will be placed? – delete May 24 '15 at 14:21
  • 1
    You are right. The image will be scaled appropriately by UIKit and in fact it's the UIImageView which will be affected by the Retina display. – Bannings May 24 '15 at 14:43
  • 1
    Also, instead of explicitly asking for a double-sized image, you can use Cloudinary's automatic DPR detection and delivery feature: http://cloudinary.com/blog/how_to_automatically_adapt_website_images_to_retina_and_hidpi_devices – Itay Taragano May 25 '15 at 11:29