Quote:
Originally Posted by cmezak
Yeah. I found that handling the transforms to correctly orient the images was the most tricky part. The documentation for this is not clear. Also, I found that images from the photo library come out pink. I couldn't resolve this, but since my app is using images from the camera (which come out just fine) it's not a big deal for me.
Good luck!
- Charlie
|
First of all, thanks for the code cmezak. You really did save my life.
I'm totally newbie about Quartz, but from trial and error, I've managed to get the code working for both camera and library.
Looks like the photo from library turn pink because CGImageGetBitsPerComponent(imageRef) will always return 5 bits per component (got 8 bits from camera images).
I'm not sure if the Generic RGB Color Space returned from CGColorSpaceCreateDeviceRGB() will assume that you use 8 bits/component picture. So that's why only the images from library was not processed properly.
Here's what I do
Code:
bitmap = CGBitmapContextCreate(NULL, longSide, shortSide, 8, image.size.width*3,
CGColorSpaceCreateDeviceRGB(), alphaInfo);
Not even sure if there would be any bad side effects for harding code like this. But I think I'm gonna keep it this way until I learn more about Quartz things.