生成缩略图
废话不多说,直接上代码 /** @param image 传入图片 @param asize 需求的大小 @return 缩略图 +( UIImage *)thumbnailWithImageWithoutScale:( UIImage *)image size:( CGSize )asize { UIImage *newimage; if ( nil == image) { nil ; else { CGSize oldsize = image. size ; CGRect rect; if (asize. width /asize. height > oldsize. width /oldsize. height ) { size . width = asize. height *oldsize. width /oldsize. height ; size . height = asize. height ; origin . x = (asize. width - rect. size . width )/ 2 ; origin . y = 0 ; else { size . width = asize. width ; size . height = asize. width *oldsize. height /oldsize. width ; origin . x = 0