How do I release a CGImageRef in iOS
Your memory issue results from the copied data, as others have stated. But here’s another idea: Use Core Graphics’s optimized pixel interpolation to calculate the average. Create a 1×1 bitmap context. Set the interpolation quality to medium (see later). Draw your image scaled down to exactly this one pixel. Read the RGB value from the … Read more