Joris Kluivers

I like to build software.

Resize a UIImage the Right Way

When deadlines loom, even skilled and experienced programmers can get a little sloppy. The pressure to ship may cause them to cut corners and look for a quick and easy solution, even if that solution is sure to cause trouble later on. Eventually, their coding style devolves into copy and paste programming, a lamentable tactic that involves cherry-picking snippets of code from a past project and putting them to use in the current one. Trevor’s Bike Shed

A great write-up on the risks of ‘copy-and-pase coding’. Solutions to coding problems found online might not always be the correct answer, they usually lack testing and might even contain hidden bugs. I’ve ran into posts like this on multiple occasions (both iOS and Android) where the most popular answer clearly was wrong. The problem is that not everyone will actually be able to see this and use the code as is in a project.

There’s a lot of wrong code floating around the net related to manipulating UIImage’s for example. Correct solutions for common UIImage manipulation tasks are discussed in the post Resize a UIImage the right way in the form of several UIImage categories.