cgimage

iPhone - Get a pointer to the data behind CGDataProvider?

I'm trying to take a CGImage and copy its data into a buffer for later processing. The code below is what I have so far, but there's one thing I don't like about it - it's copying the image data twice. Once for CGDataProviderCopyData() and once for the :getBytes:length call on imgData. I haven't been able to find a way to copy the ima...

Storing CGImage in Photos app?(iPhone)

Hi, lets say I have a CGImage and want to store it in the Photos app that comes standard with every iPod Touch/iPhone how would I do this? ...

Fatsest way to edit alpha of CGImage (or UIImage) with touch and then display?

I have two image views, one on top of the another, with two different images. As the user touches the image and moves his/her finger, the top image should become transparent along the touch points with a fixed radius. (Like the PhotoChop app). Currently I am doing it this way... For each touch. Get a copy of the image buffer from CGIm...

Replace all white/nearly white pixels in a UIImage with alpha using CGImage?

Hi there, I have a UIImage with white background. I would like replace the white background/pixels with alpha-transparent pixels. I've looked at other questions on StackOverflow, along with Quartz documentation, but have yet to find a coherent "start-to-end" for this problem. How is this done? ...

Convert bitmap image information into CGImage in iPhone OS 3

I want to create a CGImage with the color information I already have Here is the code for converting the CGImage to CML, CML_color is a matrix structure - (void)CGImageReftoCML:(CGImageRef)image destination:(CML_color &)dest{ CML_RGBA p; NSUInteger width=CGImageGetWidth(image); NSUInteger height=CGImageGetHeight(image); CGColorSpaceRef...

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 = CGDataProviderCreateWithFilename(cStr); CGImageRef image = CGImageCreateWithPNGDataProvider(provide...

Working with images (CGImage), exif data, and file icons

What I am trying to do (under 10.6).... I have an image (jpeg) that includes an icon in the image file (that is you see an icon based on the image in the file, as opposed to a generic jpeg icon in file open dialogs in a program). I wish to edit the exif metadata, save it back to the image in a new file. Ideally I would like to save th...

[iPhone SDK] Edit alpha of cgimage on touch

Hello, I have two uiimageview, i need to have the imageview transparent under the touch point..(with a circle)...to be able to see the image under the first one.. Can you share me some code or examples? Thanks! ...

Drawing an indexed image on iPhone

Hi all, The issue is drawing an indexed image on an iPhone (1 byte pr pixel, 256 colors). You can easily convert a raw image to a CGImage if it is 24 or 32 bts per pixel RGB using 'CGBitmapContextCreate' and 'CGBitmapContextCreateImage' but it does not work with indexed images, I have searched in iPhone SDK documentation and the WEB but...

what is resolution of photo taken by iPhone 4 camera ?

In specs, iPhone 4 screen resolution & pixel density * iPhone 4 has a screen resolution of 960×640 pixels, which is twice that of the prior iPhone models As we know, when we code like this, CGImageRef screenImage = UIGetScreenImage(); CGRect fullRect = [[UIScreen mainScreen] applicationFrame]; CGImageRef saveCGImage = CGIma...

Getting into pixel data of NSImage

Hi, I'm writing application that operates on black&white images. I'm doing it by passing a NSImage object into my method and then making NSBitmapImageRep from NSImage. All works but quite slow. Here's my code: - (NSImage *)skeletonization: (NSImage *)image { int x = 0, y = 0; NSUInteger pixelVariable = 0; NSBitmapImageRep *bitm...

Magnifier effect with CALayer s

Hi, I want to implement a magnifier exactly like the one is shown when an UITextView is long pressed. I got the idea from here: http://stackoverflow.com/questions/2030730/iphone-reproduce-the-magnifier-effect/2030846#2030846 But I am working only with CALayers not UIViews, hence I don't have a drawRect method to write in. I wonder whe...

CGBitmapContextCreateImage - vm_copy failed - iPhone SDK

Hi all, 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 didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection { CVImageBufferRef ...

Creating an NSImage from bitmap data

Ok, it appears that the I'm creating a PDFDocument where pixelWidth is incorrect in the images that I created. So the question becomes: How do I get the correct resolution into the image? I start with bitmap data from a scanner. I'm doing this: CGDataProviderRef provider= CGDataProviderCreateWithData(NULL (UInt8*)data, bytesPerRow * le...

Retrieving CGImage from NSView.

Hi everybody, I am trying to create CGImage from NSTextField. I got some success in this. Still I cant get CGImage that consisting of only text. I mean to say that,every time capturing the textfield I am getting color of the background window along with it.(Looks like I am not getting alpha channel info) I tried following snippet fro...

Getting resolution from a CGImageRef

I'm creating a CGImageRef out of, in one case, a TIFF file, through a CGImageSource, in another case raw bitmap data via a CGDataProvider and in another case, from a PDFPage via an NSImage. I need to know the resolution of the CGImage. Is there an easy way to find this out? in the PDFPage case, I should be able to get the pixelwidth and...

iPhone sdk, unknown error?

So I have an app that gets pixel data from a picture and then manipulates to change brightness levels via RGB values of each pixel. I have these lines of code to convert a UImage to a CGImage CGDataProviderRef dataProvider = CGImageGetDataProvider(mycgImage); CFDataRef imageData = CGDataProviderCopyData(dataProvider); void *pixels = ...

psd Image creation with layer properties using CGImageRef

Hi, Working in Mac OSX, Cocoa I have an psd image with layered property. I want to crop it to the crop rect and save this cropped image with the settings of original image. I am using CGImageRef for all the image related operations. I have enclosed the code i used to crop the image is given below. But it fails to create the layered i...

Open source for reading and writing multi layer .psd image.

Hi All, I am in Mac OSX, Cocoa . I want to read and write multi layered .psd images. With Cocoa native api's i can read or write the images as flat images.(i.e., single layered) So is there any 3rd party library available to perform the operations? This is my earlier query. http://stackoverflow.com/questions/3456560/psd-image-creati...

Adding an imageview to a layer

I'm sure this is simple but I am trying to add an array of images to a layer. Here is what I have so far: // Create the fish layer fishLayer = [CALayer layer]; //fish = [UIImageView imageNamed:@"Fish.png"]; fish.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"swim01.png"], [UIImage imageNamed:@"sw...