Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scale up an UIImage without smoothening anything?

I want to scale up an UIImage in such a way, that the user can see the pixels in the UIImage very sharp. When I put that to an UIImageView and scale the transform matrix up, the UIImage appears antialiased and smoothed.

Is there a way to render in a bigger bitmap context by simply repeating every row and every column to get bigger pixels? How could I do that?

like image 854
openfrog Avatar asked Oct 10 '10 13:10

openfrog


2 Answers

#import <QuartzCore/CALayer.h>

view.layer.magnificationFilter = kCAFilterNearest

like image 72
Peter DeWeese Avatar answered Sep 17 '22 16:09

Peter DeWeese


When drawing directly into bitmap context, we can use:

CGContextSetInterpolationQuality(myBitmapContext, kCGInterpolationNone);

I found this on CGContextDrawImage very slow on iPhone 4

like image 30
Khomsan Avatar answered Sep 17 '22 16:09

Khomsan