Questions tagged [cgimage]

CGImage represents a drawable image object in Core Graphics (the low-level procedural drawing API for iOS and Mac OS X).

563 questions
6
votes
3 answers

UIImage being released but CGImage not being released

I appear to have a memory management issue when I create UIImage instances the CGImages are not being released. I have a paging UIScrollView to scroll through a series of JPG images. Below is my entire class that is a page view in the paging scroll…
Jet Basrawi
  • 3,185
  • 2
  • 15
  • 14
6
votes
2 answers

How do I create a CGImage with RGB data?

Can anyone show me a clear example of how to use CGImageRef CGImageCreate ( size_t width, size_t height, size_t bitsPerComponent, size_t bitsPerPixel, size_t bytesPerRow, CGColorSpaceRef colorspace, CGBitmapInfo bitmapInfo, …
ReachConnection
  • 1,831
  • 6
  • 22
  • 32
5
votes
2 answers

ALAssetsLibrary ALAssetsLibraryAccessUserDeniedError

When you first try to access a user's ALAssetsLibrary, the OS will present them with a dialog asking for permission. If they do not allow this, a failureBlock will be called and will always be called in the future. Is there a way to force a prompt…
rickharrison
  • 4,867
  • 4
  • 35
  • 40
5
votes
1 answer

Does CGImage support 16 bits per channel?

bitsPerComponent says it's at most 8, but a couple of Stack Overflow questions imply 16 is supported.
Kartick Vaddadi
  • 4,818
  • 6
  • 39
  • 55
5
votes
1 answer

Pixel colors change as I save MTLTexture to CGImage?

I need to save and load metal textures to a file. Example code below is below. I'm noticing the RGB values are changing as it gets saved and reloaded again. metal texture pixel: RGBA: 42,79,12,95 after save and reload: 66,88,37,95 That got…
Rob N
  • 15,024
  • 17
  • 92
  • 165
5
votes
1 answer

iPhone CALayer image array contents values

The way to load image to the layer is simply this: CALayer *layer = [[CALayer alloc]init]; layer.contents = (id) [UIImage imageNamed:@"image.png"].CGImage; then you add the layer as sublayer to the view something like: assume you in the…
user552120
5
votes
4 answers

When to release the UIImage?

I use the following code to draw a subimage UIImage* subIm = getSubImage( large, rect ); [subIm drawInRect:self.bounds]; where getSubImage is defined as follows UIImage* getSubImage(UIImage* uim, CGRect rc){ CGImageRef imref =…
ragnarius
  • 5,642
  • 10
  • 47
  • 68
5
votes
1 answer

Why is my CGImage 3 x the size of the UIImage

I have a function that takes a UIImage and a colour and uses it to return a UIImage in just that colour. As part of the function the UIImage is converted to a CGImage but for some reason the CGImage is 3 times the size of the UIImage which means…
365SplendidSuns
  • 3,175
  • 1
  • 21
  • 28
5
votes
2 answers

How to convert NSData to CGDataProviderRef on iphone sdk?

I am getting EXEC_BAD_ACCESS errors in a CGContextDrawImage call and trying to trace it back. I have a PNG image and running a UIImagePNGRepresentation o it gives me NSData instance. I need to convert this to CGImageRef instance, so I can run the…
GAS
  • 51
  • 1
  • 2
5
votes
0 answers

I would like to convert an NSImage into an mp4

Adam Jensen has done a fantastic job @ crafting some swift code to convert an image into a mov. https://gist.github.com/acj/6ae90aa1ebb8cad6b47b The above works great, but I would like to do the job with device with slightly more CPU and some real…
user3069232
  • 8,587
  • 7
  • 46
  • 87
5
votes
1 answer

Rotate a UIImage without memory spikes

I am currently rotating images using CGContextDrawImage, but there is a giant memory spike whenever it is called. Newer devices can handle it, but devices with lower ram such as the iPhone 4s can not. The image is a large file taken by the user at…
Jojodmo
  • 23,357
  • 13
  • 65
  • 107
5
votes
1 answer

Compare RGB of two images in IOS

In my app I need to compare the RGB of two images are same or not. I am using this code... -(CGFloat)compareImage:(UIImage *)imgPre capturedImage:(UIImage *)imgCaptured { int colorDiff; CFDataRef pixelData =…
Gobinda Das
  • 143
  • 7
5
votes
1 answer

Length of data returned from CGImageGetDataProvider is larger than expected

I'm loading a grayscale png image and I want to access the underlying pixel data. However after I load get the pixel data via CGImageGetDataProvider, the length of the data returned is longer than expected. CCGDataProviderRef provider =…
jcoplan
  • 81
  • 5
5
votes
2 answers

Rotate and Crop UIImage

Imagine I have an UIImage. I need to rotate and then crop it in the global coordinate system (not UIImage coordinate system). So the resulted image will be cropped and rotated. How can I do this? CGImageCreateWithImageInRect will crop image only in…
gleb.kudr
  • 1,518
  • 12
  • 16
5
votes
2 answers

How to add text to CIImage?

I am working with the Photos framework and have created an app that will apply a filter to an image. Now instead of applying a filter, I want to add text on top of the image. This API provides me with a CIImage which I can use to create an output…
Jordan H
  • 52,571
  • 37
  • 201
  • 351