arthurdapaz

Image resize

Apr 10th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function generateSmallThumb (imagePath) {
  2.     var image = [UIImage imageNamed:imagePath];
  3.     rect = {0:{0:0,1:124},1:{0:0,1:124}};
  4.     UIGraphicsBeginImageContextWithOptions({width:124, height:124}, NO, 1);
  5.     [image drawInRect:rect];
  6.     var resizedImage = UIGraphicsGetImageFromCurrentImageContext();
  7.     UIGraphicsEndImageContext();
  8.     [UIImagePNGRepresentation(resizedImage) writeToFile:imagePath.replace("@3x","@2x") atomically:YES];
  9. }
Advertisement
Add Comment
Please, Sign In to add comment