If you're happy to stick with the current primaries the app is using, the recommended route from our gamma-encoded images to linear is by doing a square. This may sound odd, since the usual quoted gamma function is pow(2.2), but the official ICC profiles for 601/709 are piecewise linear functions that are better approximated by pow(2.0), or using the full piecewise function.
There's no current shipping or free ICC profiles to handle the Rec. 709/601 primaries, which is what you'd need if you want to do the full conversion to a working set of primaries of your choice. So our current recommendation for linear is:
1) Square your gamma-corrected input images, leaving them in the app's primaries.
2) Do your color calculations on these linear values.
3) Convert the linear values back to gamma corrected by doing a square root.
One thing to note (that's probably obvious) is that you'll need to be working at >8 bit depth for all of this linear work. Also our favorite resources for more information on the color matching process and gamma are the Poynton FAQs, and his in-depth book:
http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.htmlhttp://www.poynton.com/notes/colour_and_gamma/GammaFAQ.htmlhttp://www.poynton.com/DVAI/index.htmlApple's own color scientist Garrett Johnson will also be releasing a book in a couple of months that covers some of these questions too. He also was a great help in preparing these recommendations.