3
votes

I have developed an small iOS app, where i have image named bg.png which is of dimension

1024 * 768 for iPad.

Now i have many images which has been created for iPad size. Now i need to make support of this app in iPhone, for that weather i need to create same set of images agian for iPhone size,

568 * 300 for iPhone.

or there is another way to do this?

8

8 Answers

1
votes

Scaling down the iPad image assets will destroy UX on iPhone. Also images like icon, splash screen usually contain company logo. Scaling down will tamper the look of the logo and overall image. Better way is to create separate images for iPhone form factor. Trim the png files using http://tinypng.org/ to keep binary size low.

Cheers!
Amar.

0
votes

You can use this code to re-size the image by following code,

CGSize newSize = CGSizeMake(568, 300);
UIGraphicsBeginImageContext(newSize);
[yourIpadImage drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
newIphoneImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
0
votes
   + (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
        //UIGraphicsBeginImageContext(newSize);
        UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
        [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
        UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();    
        UIGraphicsEndImageContext();
        return newImage;
    }

You have option to change the Size of Your Image

0
votes

sathiamoorthys solution is a difficult way or rescaling your image. You can do that by simply creating a UIImageView, initialize it with a UIImage and then change its frame. Note that your image will look scaled/distorted that way.

0
votes

follow this:

  1. open the image in preview.

  2. go to tools > adjust size

  3. put in whatever size you want.

  4. save the image as a different name.

0
votes

yes you should create duplicate and resize them for iphone. Using same images for iphone will bring memory issues because the images are unnecessarily big for iphone.

Use any software to resize them or you can do this using preview also as Nikita described above

If you are doing this to create universal app then you must postfix ~ipad in the name of the image file.

0
votes

Please visit this link, May help you and solve your issue.

There is the some tips like:

  1. Propotional scale,
  2. Resize
-1
votes

If you want your images to show up unscaled, you are going to need an additional image with the correct size. So supporting both iPad with and without retina screens would require one image of 768x1024 and one of 1536 x 2048. For iPhone 3.5" you would need 960 x 640 when it is a retina screen or 480 x 320 when it is non-retina. For iPhone 5 (4" screen) you would need 568 x 320. If you use UIImages method imageNamed: there is help from Apple. It loads on retina devices that method looks for the the image you specified with the postfix '@2x'. So you can simply code: UIImage * myImage = [UIImage imageNamed: @"myImage"] If you make sure you project contains myImage.png for non-retina devices and [email protected] for retina devices the right image gets loaded at runtime.