I am downloading images from server and saving them locally in my iphone,But sometimes the image is too large.for ex (2500*3200). i want to reduce the size to 300*500 before downloading that into iphone.how can i do this .Please help me in this .THANKS IN ADVANCE
+(void)DownloadImage:(NSString*)ImagePath{
    if ([ImagePath isEqualToString:@""])
        return;
    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[IMAGEURL stringByAppendingPathComponent:Im开发者_如何学GoagePath]]];
    NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    [data writeToFile:[docDir stringByAppendingPathComponent:ImagePath] atomically:YES];        
}
If you don't have option to scale it down on the server (which would be better).
then look at this: Any code/library to scale down an UIImage?
which should enable you to download the image, then scale it down, then save it to the phone etc.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论