ios - Objective C Resize image as 2x image -
i resizing image after resizing image not returning in quality here code
- (uiimage*)imagewithimage:(uiimage*)image scaledtosize:(cgsize)newsize; { uigraphicsbeginimagecontext( newsize ); [image drawinrect:cgrectmake(0,0,newsize.width,newsize.height)]; uiimage* newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return newimage; }
here code how call
uiimage *image = [self imagewithimage:self.selectedimage scaledtosize:cgsizemake((self.imageview.image.size.width*self.slider.value), (self.imageview.image.size.height*self.slider.value))];
here small image scaling.
you should use uigraphicsbeginimagecontextwithoptions
instead of uigraphicsbeginimagecontext
.
for example,
uigraphicsbeginimagecontextwithoptions(signview.bounds.size, signview.opaque, 0.0); [signview.layer renderincontext: uigraphicsgetcurrentcontext()]; // uiimage *imgmysignature = uigraphicsgetimagefromcurrentimagecontext(); signview.img = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
i rendering image uiview
i.e signview
. can use this.
Comments
Post a Comment