cgimage

Create new image using just some pixels data from the source image based on them color

馋奶兔 提交于 2019-12-25 04:07:01
问题 I have original image and I can cycle all pixels using @patrick-rutkowski answer here. Also I have this answer seems to create image with pixel data. But I can't understand how to combine these two answers. So the first task is get pixel and second is add it to another CGImage. For example if I want to extract all red pixels from the original image and add these red pixels to another image. I suppose it's way to go. 来源: https://stackoverflow.com/questions/28310186/create-new-image-using-just

iPhone - UIImage imageWithData returning nil

一曲冷凌霜 提交于 2019-12-24 01:52:48
问题 I need to create an UIImage from a byte array. Here is now I create the byte array: image = CGImageCreateWithImageInRect(aux.CGImage, imageRect); context = CGBitmapContextCreate (data[i][j], TILE_WIDTH, TILE_HEIGHT, bitsPerComponent, bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);//kCGImageAlphaNoneSkipFirst);//kCGImageAlphaNone);// CGContextDrawImage(context, CGRectMake(0, 0, TILE_WIDTH, TILE_HEIGHT), image); data[i][j] = CGBitmapContextGetData

Help please with CGBitmapContext and 16 bit images

你说的曾经没有我的故事 提交于 2019-12-24 00:47:08
问题 I'd LOVE to know what I'm doing wrong here. I'm a bit of a newbie with CGImageRefs so any advice would help. I'm trying to create a bitmap image that has as it's pixel values a weighted sum of the pixels from another bitmap, and both bitmaps are 16bits per channel. For some reason I had no trouble getting this to work with 8bit images but it fails miserably with 16bit. My guess is that I'm just not setting things up correctly. I've tried using CGFloats, floats and UInt16s as the data types

Image is rotated 90 degrees when using clipToMask

一世执手 提交于 2019-12-23 04:45:43
问题 I am trying to clip a portion of an image I take with a camera. Here's my clipping code: - (UIImage*) maskImage:(UIImage *)image { CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); UIImage *maskImage = [UIImage imageNamed:@"mask3.png"]; CGImageRef maskImageRef = [maskImage CGImage]; // create a bitmap graphics context the size of the image CGContextRef mainViewContentContext = CGBitmapContextCreate (NULL, maskImage.size.width, maskImage.size.height, 8, 0, colorSpace,

Memory issue using CGImage.ScreenImage and UIImagePickerController Mono Touch

我的未来我决定 提交于 2019-12-23 03:43:05
问题 I'm trying to create an IP Camera application for iPhone using mono touch. To get the camera feed, I call the CGImage.ScreenImage method continuously and convert the resulting UIImage into a byte array which is then transmitted across to the browser. The camera feed is displayed using a UIImagePickerController class by setting the SourceType = UIImagePickerControllerSourceType.Camera; Here are the complete code for the ImageController class: public class ImageController :

CGImage to UIImage doesn't work

≯℡__Kan透↙ 提交于 2019-12-22 17:52:04
问题 I'm developing and iOS app for iPad and I use Grabkit in order to get images from Facebook, Twitter, Flicker and also the Camera Roll. To get the images from the last one, I need to convert a CGImage to an UIImage, but I'm having trouble with that. Is like if I didn't get any image, because when I use the UIImage later, the app crashes with this log: *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 653]' I'm using the

Drawing histogram of CGImage in Swift 3

血红的双手。 提交于 2019-12-22 08:12:36
问题 I have a problem with vImageHistogramCalculation_ARGB8888 method while trying to convert library from Swift 2 to Swift 3 version. The problem is that the method accepts "histogram" argument only as UnsafeMutablePointer<UnsafeMutablePointer<T>?> but Swift 3 construction let histogram = UnsafeMutablePointer<UnsafeMutablePointer<vImagePixelCount>>(mutating: rgba) return unwrapped value, so I can't cast it to properly type. The compiler error is: : Cannot invoke initializer for type

Create a gif with UIImages

随声附和 提交于 2019-12-21 20:55:00
问题 I am referring to this post . I am trying to make a gif file with the images created by screenshot. I am using a timer to create the snapshot of the screen,so that I get required amount of frames that could be used to create a gif. I take snaphots every 0.1 seconds (I will later end this timer after 3 seconds). Here is my code to take snapshots of my UIView: -(void)recordScreen{ self.timer= [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(takeSnapShot) userInfo:nil

Mixing Images and Video using AVFoundation

ぐ巨炮叔叔 提交于 2019-12-21 04:51:13
问题 I'm trying to splice in images into a pre-existing video to create a new video file using AVFoundation on Mac. So far I've read the Apple documentation example, ASSETWriterInput for making Video from UIImages on Iphone Issues Mix video with static image in CALayer using AVVideoCompositionCoreAnimationTool AVFoundation Tutorial: Adding Overlays and Animations to Videos and a few other SO links Now these have proved to be pretty useful at times, but my problem is that I'm not creating a static

Square thumbnail from UIImagePickerViewController image

南笙酒味 提交于 2019-12-20 09:04:08
问题 In my app the user selects an image or take a picture using UIImagePickerViewController. Once the image was selected I want to display its thumbnail on a square UIImageView (90x90). I'm using Apple's code to create a thumbnail. The problem is the thumbnail is not squared, the function, after set kCGImageSourceThumbnailMaxPixelSize key to 90, seems only to resize the image's height, and as far as I know the kCGImageSourceThumbnailMaxPixelSize key should be responsible for setting the height