uiimage - Xcode 5. I am scaling picked images. How do I get the size in bytes of the new image in displayed in the console? -
in image picker scaling picked image after picked want see difference between resulting image , original. there nslog statement can throw in there it?
it nice know original images numbers in contex: cgsize targetsize = cgsizemake(150,150);t
heres code using scaling:
-(void) imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { [picker dismissviewcontrolleranimated:yes completion:nil]; uiimage *sourceimage = [info objectforkey:@"uiimagepickercontrolleroriginalimage"]; cgsize targetsize = cgsizemake(150,150); uigraphicsbeginimagecontext( targetsize ); [sourceimage drawinrect:cgrectmake(0,0,targetsize.width,targetsize.height)]; uiimage* targetimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); self.lookpik.image = targetimage;
you can test size of uiimage in bytes this:
nsdata *imagedata = uiimagejpegrepresentation(yourimage, 1); nslog(@"size of image %d bytes", [imagedata length]);
http://pinkstone.co.uk/how-to-test-the-size-of-a-uiimage-in-bytes/
Comments
Post a Comment