Questions tagged [cgimageref]

The CGImageRef opaque type represents bitmap images and bitmap image masks, based on sample data supplied. This is part of the Core Graphics framework.

The CGImageRef opaque type represents bitmap images and bitmap image masks, based on sample data supplied. A bitmap (or sampled) image is a rectangular array of pixels, with each pixel representing a single sample or data point in a source image. This is part of the Core Graphics framework.

See and as well.

151 questions
47
votes
3 answers

UIImage -> CGImageRef

I'm building an Iphone app that needs to convert a UIImage to a CGImageRef. I have no idea how to do this and would love some help. I have no background in working with images... :)
Tyler Wall
  • 3,747
  • 7
  • 37
  • 52
27
votes
1 answer

Getting NSImage from CGImageRef

I am trying process an image in CoreGraphics and then return the processed image back to an NSImage for saving and displaying. I have ample resources on how to perform these functions in iOS but the helper methods seem to be missing in NSImage. In…
MobileOverlord
  • 4,580
  • 3
  • 22
  • 30
13
votes
1 answer

Any way to encode a PNG faster than UIImagePNGRepresentation?

I'm generating a bunch of tiles for CATiledLayer. It takes about 11 seconds to generate 120 tiles at 256 x 256 with 4 levels of detail on an iPhone 4S. The image itself fits within 2048 x 2048. My bottleneck is UIImagePNGRepresentation. It takes…
Luke
  • 13,678
  • 7
  • 45
  • 79
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

How do I release a CGImageRef in iOS

I am writing this method to calculate the average R,G,B values of an image. The following method takes a UIImage as an input and returns an array containing the R,G,B values of the input image. I have one question though: How/Where do I properly…
samuelschaefer
  • 614
  • 2
  • 10
  • 26
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
8
votes
2 answers

Setting the contents of a CALayer to a CGImageRef on iOS with ARC on

The following code compiles fine with manual memory management, but fails under ARC: CALayer *layer = [CALayer layer]; layer.contents = [[UIImage imageNamed:@"dial.png"] CGImage]; The error is: Automatic Reference Counting Issue: Implicit…
cfischer
  • 24,452
  • 37
  • 131
  • 214
7
votes
1 answer

Getting message in console: "CreateWrappedSurface() failed for a dataprovider-backed CGImageRef."

Updated to Xcode 7 and getting this (warning?) message while an image was being rendered in an operation: CreateWrappedSurface() failed for a dataprovider-backed CGImageRef. There was no message like this under Xcode 6.4. Got which code part threw…
Adam Szabo
  • 293
  • 2
  • 11
6
votes
4 answers

Creating a thumbnail from UIImage using CGImageSourceCreateThumbnailAtIndex

I want to use the function CGImageSourceCreateThumbnailAtIndex to create a thumbnail from an UIImage. All I have is the UIImage itself. The image is the snapshot on a UIView. Please, I don't want to use any other method to create the thumbnail, just…
Duck
  • 34,902
  • 47
  • 248
  • 470
6
votes
3 answers

Objective C: How to convert CGImageRef to UIImageView?

I'm using the XZINGObjC framework to create an EAN-Barcode-Image. Following the documentation, I'm doing it like //in viewDidAppear //XZING: create Matrix NSString* eanString = @"1234567890123"; //sth. like that ZXBitMatrix* result = [writer…
longi
  • 11,104
  • 10
  • 55
  • 89
5
votes
1 answer

Resize CGImageRef without anti-liasing

I am trying to resize a 10x10 pixel CGImageRef, captured like this: CGImageRef imageRef = CGImageCreateWithImageInRect(screenShot, CGRectMake(mouseLoc.x-5, screen_height-mouseLoc.y-5, 10, 10)); CGContextRef mainViewContentContext =…
Marek
  • 83
  • 1
  • 4
5
votes
1 answer

How to convert a UIImage object created from a CGImageRef into raw data and back again

Let's say you start with a UIImage and you wish to crop it. The most common method is to use CGImageCreateWithImageInRect to get a CGImageRef and create a new image from it like so: CGRect cropRect = CGRectMake(x*width, y*height, width,…
Mike
  • 1,727
  • 2
  • 19
  • 32
5
votes
1 answer

CGImageRef width doesn't agree with bytes-per-row

I'm trying to read pixels out of the screen buffer, I'm creating a CGImageRef with CGDisplayCreateImage, but the values for CGImageGetWidth and CGImageGetBytesPerRow Don't make sense together, dividing the bytes per row by the bytes per pixel gives…
porglezomp
  • 1,333
  • 12
  • 24
5
votes
2 answers

Converting NSData to CGImage and then back to NSData makes the file too big

I have built a camera using AVFoundation. Once my AVCaptureStillImageOutput has completed its captureStillImageAsynchronouslyFromConnection:completionHandler: method, I create a NSData object like this: NSData *imageData =…
Will
  • 1,697
  • 17
  • 34
5
votes
1 answer

Getting UIImage from CIImage does not work properly

I am having trouble with getting a UIImage from and CIImage. The line of code below works fine on iOS6: (Output image is an CIImage) self.imageView = [UIImage imageWithCIImage:outputImage]; or [self.imageView setImage:[UIImage…
dana0550
  • 1,125
  • 1
  • 9
  • 16
1
2 3
10 11