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))]; 

result of image sma

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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -