CGImage represents a drawable image object in Core Graphics (the low-level procedural drawing API for iOS and Mac OS X).
Questions tagged [cgimage]
563 questions
12
votes
4 answers
CGImage/UIImage lazily loading on UI thread causes stutter
My program displays a horizontal scrolling surface tiled with UIImageViews from left to right. Code runs on the UI thread to ensure that newly-visible UIImageViews have a freshly loaded UIImage assigned to them. The loading happens on a background…

JBx
- 123
- 1
- 2
- 7
10
votes
2 answers
NSImage to cv::Mat and vice versa
while working with OpenCV I need to convert a NSImage to an OpenCV multi-channel 2D matrix (cvMat) and vice versa.
What's the best way to do it?
Greets,
Dom

dom
- 11,894
- 10
- 51
- 74
10
votes
5 answers
iPhone CGContextRef CGBitmapContextCreate unsupported parameter combination
In my application I need to resize and crop some images, stored locally and online. I am using Trevor Harmon's tutorial which implements UIImage+Resize.
On my iPhone 4(iOS 4.3.1) everything works OK, I have no problems. But on my iPhone 3G (iOS 3.2)…

Andrei Neacsu
- 1,453
- 3
- 20
- 33
10
votes
1 answer
CGBitmapContextCreateImage - vm_copy failed - iPhone SDK
I am having an issue using CGBitmapContextCreateImage in my iPhone app.
I am using AV Foundation Framework to grab camera frames using this method:
- (void)captureOutput:(AVCaptureOutput *)captureOutput…

Brett
- 11,637
- 34
- 127
- 213
9
votes
2 answers
Most efficent way to create a CALayer with an image in it?
I am wondering what the most efficient way is to make a CALayer with an image in it.
I know you can load a UIImage and then call [image CGImage] but is this the best way of going about it? As far as I can tell from Apple's documentation this is the…

Michael Gaylord
- 7,282
- 8
- 50
- 47
9
votes
2 answers
How to determine and interpret the pixel format of a CGImage
I'm loading this (very small) image using:
UIImage* image = [UIImage named:@"someFile.png"];
The image is 4x1 and it contains a red, green, blue and white pixel from left to right, in that order.
Next, I get the pixel data out of the underlying…

Matt Comi
- 610
- 6
- 9
9
votes
3 answers
Crop UIImage to alpha
I have a rather large, almost full screen image that I'm going to be displaying on an iPad. The image is about 80% transparent. I need to, on the client, determine the bounding box of the opaque pixels, and then crop to that bounding box.
Scanning…

MikeQ
- 1,817
- 3
- 19
- 27
9
votes
1 answer
CGImage gets stretched in CALayer
I have an NSMutableArray of CGImage objects. All the images have different dimensions ( 80x20 px, 200x200 px, 10x10 px, etc...)
I'm trying to animate these in CALayer which has 256x256 pixels size. The animation works, but my CGImages get stretched…

PrimeSeventyThree
- 940
- 2
- 9
- 24
9
votes
1 answer
CGImageSource to CGImage?
I got this following code that access a PHAsset. I need to pass a CGImage out of this:
let imageManager = PHImageManager.defaultManager()
imageManager.requestImageDataForAsset(self.asset!, options: nil, resultHandler:{
(data, responseString,…

Gizmodo
- 3,151
- 7
- 45
- 92
9
votes
4 answers
Swift accessing EXIF Dictionary
Info: Using Swift and the CGImageSourceCreateWithURL function.
I am attempting to load a file from a URL and then edit a dictionary which has all the data from that particular photo.
This is the code from the .swift file.
let url = NSURL(string:…

user3423554
- 101
- 1
- 1
- 3
9
votes
5 answers
CGImage of UIImage return NULL
I created a function for splitting an image into multiple images, but when I take take the CGImage of the UIImage, the CGImage returns NULL
NSArray* splitImage(UIImage* image,NSUInteger pieces) {
NSLog(@"width: %f,…

Otium
- 1,098
- 8
- 20
8
votes
3 answers
add/pass (exif) thumbnail to CGImageDestinationRef
On CGImageDestinationRef Apple's reference it mentions that It can contain thumbnail images as well as properties for each image. The part with the properties works nice, by setting the properties parameter when adding a image to the…

alex-i
- 5,406
- 2
- 36
- 56
8
votes
1 answer
iPhone - CGImageCreateWithImageInRect rotating some camera roll pictures
I am working on a pixelate application for iPhone. Because the pictures taken with the iPhone 4 camera are too big and therefore the application is working really slow when updating the pixelated picture, I am trying to create tiles of the picture…

Andrei Neacsu
- 1,453
- 3
- 20
- 33
8
votes
4 answers
Image segmentation for iOS
I need a way to transform image containing human into a image containing only body sihlouette in one color. First i took a look at Canny edge detector (OpenCV implementation), but this may lead to problems with background of the image.
I`ve tried…

Ivan Alek
- 1,899
- 3
- 19
- 38
8
votes
1 answer
Properly crop an image obtained from the photo library
I've been working on this all day, and have looked at lots of questions here on SO and google, but so far I can't come up with anything quite right.
I have taken a photo on an iPad running iOS 5.1.1 and cropped it using the Photos app. I then get a…

lnafziger
- 25,760
- 8
- 60
- 101