2

I'd like to alter images programmatically. Specifically for the iPhone, but, general answers could help. For example, how could I, programmatically, add filters effects, such as those available in Photoshop.

Clearly it is possible as exemplified by apps such as Fat Booth. What is the starting point for this? Load an image as NSData and learn how PNGs are encoded and go to work with the algorithm? Possible? Easier solutions?

Thanks for the help!

  • I'm pretty sure this is a little to complicated for one question. I would try recreating an effect for iPhone and then ask what is the matter. I think the library you are looking for is CGGeometry too. (I think... or I know OpenGL ES should do fine too). –  Sep 29 '10 at 02:31

2 Answers2

1

Chapter 21 of iPhone SDK Development has an example of how to display and manipulate a photo that is pretty easy to follow. More complex effects require more complex code, but it's something to start with.

Kris Markel
  • 12,142
  • 3
  • 43
  • 40
1

First obtain image in raw format (raw like in raw bytes for every pixel [rgb][rgb]) then manipulate the pixels and convert back from raw format to image.

Here you can find information how to convert uiimage to and from raw pixels data, for example:

Raw to UIImage: Creating UIImage from raw RGBA data

UIimage to Raw: Can I edit the pixels of the UIImage's property CGImage

If you need geometric transformations you can use mapping of coordinates or opengl and use your image as a texture on some mesh, manipulate the mesh (geometrically) and render the scene back to an image.

You don't need to know how the images are encoded into PNGs or JPGs it can be done for you by the system. You just need to know what you want to achieve and then build your own algorithm.

Have fun!

Community
  • 1
  • 1
bor
  • 658
  • 7
  • 19