I need a method for resizing UIImage like in photoshop with “nearest neighbour” resampling. I was looking for some, but everything I found was about CoreGraphics thicks to improve bicubic resampling quality. I have pixel-style design in my app, and a lot of stuff I create by pixel and then enlarge it with x5 multiplier (and it takes a lot of time, so I even close to writing a script for Photoshop). For example:
> 
But I really don’t need this like result of resampling:

Maybe anyone will show me the right way.
When you draw your image into a graphics context, you can set the graphics context’s interpolation quality to “none”, like this (e.g. in a view’s
drawRectmethod):If you need the result as a
UIImage(e.g. to assign it to a built-in UI control), you could do this withUIGraphicsBeginImageContext(you’ll find lots of examples for that).An alternative would be to set the
magnificationFilterproperty of an image view’s layer:This is probably faster and more memory-efficient, because you don’t need to redraw the image.