title: Can't create Retina images with CGContextDrawImage
body: <p>I'm creating an image by combining two other images, using CGContext. Even if I have the @2x images, I can't succeed to create an retina image.</p>
  
  <p>Here's my code. Could you please help ?</p>
  
  <pre><code>-(UIImage*)makePinImageWithImage:(UIImage*)icon {
  UIImage * pin = [UIImage imageNamed:@"defaultPin.png"]; // I have the @2x one.
  int w = pin.size.width;
  int h = pin.size.height;
  
  CGRect iconRect = CGRectMake(16, 47, 24, 26); // the frame where mix icon in pin
  
  CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
  CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 8 * w, colorSpace, kCGImageAlphaPremultipliedFirst);
  
  // Drawing pin in context
  CGContextDrawImage(context, CGRectMake(0, 0, w, h), pin.CGImage);
  CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1);
  
  // Drawing icon in context
  CGContextDrawImage(context, iconRect, icon.CGImage);
  CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1);
  
  // Getting back the final image
  CGImageRef imageCG = CGBitmapContextCreateImage(context);
  
  CGContextRelease(context);    
  CGColorSpaceRelease(colorSpace);
  
  UIImage * createdImage = [UIImage imageWithCGImage:imageCG];
  CGImageRelease(imageCG);
  
  return createdImage;
  }
  </code></pre>
  
  <p>Thanks</p>