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
-1
votes
2 answers
Covering a CALayer with a CGImage
I have a CGImage that I want to show in a CALayer. Setting the content and the gravity to the bottom-left works like expected.
layer.contents = cgimage
layer.contentsGravity = .bottomLeft
Now I want center and cover the full layer. Using .center…

tcurdt
- 14,518
- 10
- 57
- 72
-1
votes
1 answer
Create CGImage from Data multiple times results with previous image override
When generating a CGImage one can choose between an initializer using JPEG-encoded data, PNG-encoded data or just data. I'm generating an image from a Data object containing 16 bit grayscale values.
The initializer required a CGDataProvider which…

Yonatan Vainer
- 453
- 5
- 15
-1
votes
1 answer
how to speed up the processing of RGB operation in a CGImage struct of macos/swift
I've got my RGB data of the CGImage. but the processing to get avrage color is so slow.
any idea? apreciated.
let screenShot:CGImage = CGDisplayCreateImage(activeDisplays[Int(index)],rect: myrect)!
let dp: UnsafePointer =…

JoJo.Z
- 1
-1
votes
1 answer
iOS: How to get pixel data array from CGImage in Swift
I need to get pixel data as byte array from a CGImage that can be RGB8, RGB16, GRAYSCALE8 or GRAYSCALE16. Previous solutions such as this one produce a dark or distorted image.

georgebp
- 193
- 3
- 17
-1
votes
3 answers
Unable to compress tiff file in swift
My app has a requirement to capture a snapshot of a paper document using the iPad camera and pass it to a REST API in Tiff Format.
I have tried to capture an image using "UIImagePickerController" and convert it to Tiff format using "kUTTypeTIFF" in…

Boopathi Sakthivel
- 65
- 1
- 8
-1
votes
1 answer
Release memory when resizeing UIImage in for sentence
I made a method to resize an image. When it resizes an image in images array, it become too much memories(e.g. 200MB~300MB) especially when an image is a High-Quality image(iPhone6/6s). My Project is in ARC. If I want to make it, how do I have to…

masuhara
- 179
- 1
- 2
- 9
-1
votes
1 answer
Objective c - UIImage resizing issue
I have a resource (.png file) that show a picture frame (border).
This .png file is size 100x100px, and the border width is 10px.
My Question:
How can I create another UIImage from this image, with a different size, without ruin the border's…

Eyal
- 10,777
- 18
- 78
- 130
-2
votes
1 answer
Using CGImage to generate a low quality JPG from data?
I have some code which loads a jpg from data and displays it in a UIImageView. Because this takes a second, I want to load a lower quality version of the image and display that while the full image is loading. Is this possible?

Andrew
- 15,935
- 28
- 121
- 203