Questions tagged [uiimage]
The basic image handling class of Cocoa-Touch on iOS. It is Available in iOS 2.0 and later.
9,234
questions
0
votes
1
answer
20
views
Cannot force image to be rounded in custom UIImageView
I have a custom UIImageView that acts like a 'carousel' in that users can swipe it to see an image (which, by the way, I adapted from this excellent post on Medium.
I want the corners to be rounded to ...
0
votes
0
answers
46
views
UIImage drawInRect:blendMode:alpha: occur crash in iOS 17. How to fix that?
The code runs correctly before iOS 17.0. This is the stack message of the crash in iOS 17.0. Is this a new bug in iOS 17.0?
0 VideoToolbox 0x00000001b145025c ...
0
votes
0
answers
36
views
append uiImage to uiImageArray
I want to append an image or oldimageArray to newimageArray, and display all the images, but I am getting an error when i building code:
error message
"No exact matches in reference to static ...
-1
votes
0
answers
16
views
How can I check if a UIImage is a whole screen image?
Is there a way to check if a UIImage is whole screen? The only way I can think of is by taking the frame and checking if it fits with UIScreen mainScreen and it's scaled frame. However, that API is ...
0
votes
0
answers
26
views
Change ThumbImage slider
I'm working in swift and I need to move the thumbImage of a slider like by default the image in centered but i need to move the image to the top.
I tried this but dind't work for me
let verticalOffset:...
-2
votes
1
answer
30
views
swift How to change uiimage background and selected area color [closed]
i have a uiimage like this white background and selected area color (red),
i want to save as this image ,
become black background and selected area color become to white,
how can to it ?
0
votes
0
answers
14
views
Swift change corner radius of image in TabBar using url data
I am trying to change the corner radius of an image in the tab bar after updating the image from data retrieved by the url.
I tried implementing layer.cornerRadius in viewDidAppear along with ...
1
vote
2
answers
70
views
Image resize crash in share extention
I'm trying to implement a share extension in my ios application. I want to share photos and before the app will send them to the backend I want to resize the photos.
I'm using this function:
+(UIImage*...
0
votes
1
answer
33
views
UIImage memory different between simulator and real device
Hi,
Asking something about memory usage difference between simulator(iPhone 14 pro) and my Real device(iPhone 12 mini).
The troublemaker code is here
@objc func handlePan(sender: ...
0
votes
2
answers
39
views
Change image scale in UIImageView
I'm trying to change the image scale in a UIImageView, I want it to be smaller and keep its ratio.
I tried:
cameraPhoto.image?.scale = CGFloat(0.5)
but it doesn't work. I get:
Cannot assign to ...
0
votes
3
answers
60
views
How to render UILabel at certain point in UIImage?
I'm using code found here to create an image with text that is scaled to available size:
CGFloat size = 100.0;
CGRect drawRect = CGRectMake(10, 10, 80, 25);
UILabel *myLabel = [[UILabel alloc] ...
0
votes
0
answers
42
views
SwiftUI tint image, Image from UIImage constructor -> lost of tint
I struggle with SwiftUI Image and its tint color.
I use the Image Constructor from UIImage. Since UIImage have this method to tint that returns a new UIImage (https://developer.apple.com/documentation/...
0
votes
0
answers
35
views
Creating UIImage with Data gives wrong CGImage resolution
I need to convert a RAW image to JPEG and then apply some calculations to the image.
I need the image in both CGImage and UIImage formats.
For some reason, image resolution is correct when it comes to ...
1
vote
2
answers
111
views
UIImage and UIimage.pngData returns two different image
MRE
import SwiftUI
struct SwiftUIView: View {
func maskImage(image: UIImage, mask: UIImage) -> UIImage {
let imageReference = image.cgImage!
let maskReference = mask....
0
votes
1
answer
55
views
How to detect when two CAShapeLayers intersect and to change the color of the intersecting pixels
I have a class called ShapeView which subclasses UIImageView. Within this class, there is a CALayer property called shape which I use to define various types of complex shapes. Using ...
1
vote
1
answer
30
views
From UIView to UIImage ( LottieAnimation)
I have lottieAnimation on my cell, using slider i can change the current frame of the animation, next what i want is to save my animation on scpecific frame as UIImage, so i can save it to users ...
0
votes
0
answers
63
views
PHPicker - All selected UIImages returning nil
Good day.
I'm using PHPicker in order to implement the use of selecting multiple photos and I've encountered an issue when trying to handle the deselecting action.
When I deselect one of the pre-...
1
vote
1
answer
33
views
Why does UITapGestureRecognizer not work properly for cell images in Swift collection view?
I have added UITapGestureRecognizer for collectionview cell image like
code: with this code if i tap on two cell images then both are showing. Here if i tap on second cell image then how to remove ...
0
votes
1
answer
45
views
SwiftUI: SF Symbol distortion when using `Image` directly vs via `UIImage`
With the following SwiftUI code
import SwiftUI
struct ContentView: View {
var body: some View {
HStack {
VStack {
Text("Proportional")
Image(systemName: "...
0
votes
0
answers
130
views
How to crop any images as 16:9 rectangles with Swift?
I have been trying for several days without succeeding, as said in the title, to crop any images as 16:9 rectangles.
In fact, I want to create thumbnails, doing the following: cropping, resizing and ...
0
votes
1
answer
76
views
Add GPS data to UIImage
I have a custom in-app build camera. This camera can take photos and videos and after this it saves the photos to the user library. I now want to add the current location from the iPhone while the ...
1
vote
1
answer
65
views
`kCMPhotoError_UnsupportedPixelFormat` when using image created using `ImageRenderer`
I'm using ImageRenderer to render a SwiftUI view to a UIImage. I am able to successfully render a PNG from that using pngData(). But if I call jpegData() I get the following error:
writeImageAtIndex:...
0
votes
0
answers
13
views
Image loaded from documents in Swift get rotated in imageview [duplicate]
I'm currently saving and loading images from the documents folder using Swift. The image is saved and loaded fine, but some images get rotated when loaded into an image view.
This is my saving code:
...
0
votes
1
answer
64
views
Why is CGImage .cropping(to: ) not cropping to the correct aspect ratio
When using .cropping(to: ) on a CGImage the aspect ratio is not being respected.
As you can see the output cropped image height: 1080.0 should actually be 1350.0
Why is this crop not consistent with ...
0
votes
2
answers
42
views
iOS Screenshot preview UIImage size incorrect
When I take a screenshot and grab the preview thats automatically placed in the bottom left hand corner of the device, the image in my action extension has a height/width that’s divided by 3 (device ...
0
votes
0
answers
63
views
Sending image data by x-callback-url is truncating the image
I'm trying to send data from an application Source to application Target. Everything works fine except the image part. When I encode the image as base64 and send it, the base64 code is truncated. I'm ...
1
vote
1
answer
42
views
display image from PhotoLibrary
I want to display an image selected from PhotoLibrary. The ImagePicker brings up the PhotoLibrary and I am able to select it but it wont display in the view.
I have the placeholder for displaying the ...
0
votes
0
answers
14
views
How can I get points of UIBezierPath? [duplicate]
I have already A path(UIBezierPath), and I draw copy A path at other UIImage.
I can get last point(path.currentPoint), But I can't get start point.
Search about it, and tried many things but I'm ...
0
votes
1
answer
28
views
Custom CIFilter - a CIColorCube - does not change the UIImage [duplicate]
I have made a custom CIColorCube filter, to turn an image in predetermined shades of gray (evenly spaced, black and white included) into a coloured image, with each shade turned into a different hue.
...
1
vote
0
answers
59
views
How to generate a thumbnail for the last scene of a live broadcast in real-time?
I am working on a project that involves generating a thumbnail image for the last scene of a live broadcast in real-time. I have implemented a method that uses the ACThumbnailGenerator class to ...
0
votes
0
answers
69
views
SwiftUI, putting a scalable UIImage in a ScrollView
I have a routine that allows a user to select an image from their Photo Library.
I then wanted to be able to scale the image via a pinch gesture. I have that working:
struct ContentView: View {
@...
0
votes
1
answer
29
views
Image not filling the UI View
I am trying to create a profile page that has a user image in a UI View. However, when I load the image it does not fill the circular UI View I created.
Here is the code:
profileImageView....
0
votes
2
answers
357
views
How to reduce file size of png image in Swift by reducing resolution
I'm looking for ways to reduce the file size of a PNG file via an image resize, not further compression.
There is a lot of sample code here that compresses a UIImage by turning it into a JPEG.
Like ...
0
votes
0
answers
66
views
Swift UIImage convert as PDFDocument with PDFKit
In my app i want to make PDFDocument from array of images, i use code below for this purpose, but my app crashes because of memory runs out, i used autoreleasepool but that doesn't help. What should i ...
0
votes
0
answers
44
views
Google MLKit PoseDetection issue with CVPixelBuffer
I'm trying to implement pose detection using GoogleMLKit PoseDetection
And for faster performance, I use CVPixelBuffer to create the MLImage, which gets passed to PoseDetector's results(in:) method.
...
0
votes
1
answer
110
views
Saving a URL to camera roll
If I store my images in firebase in a URL form, how could I then save them to my actual iPhones camera roll?
In another project I used the following code to save images, however this doesn't work with ...
0
votes
1
answer
52
views
How to compress image from server to 500kB?
I want to send pictures through the KakaoTalk app with UIActivityViewController. However, the KakaoTalk app has a capacity limit of 500kB per picture. Currently, the photos I receive from the server ...
0
votes
0
answers
39
views
The CVPixelBuffer created from UI image is nil or empty
I tried to create a CVPixel buffer of the size 299x299 and the format of kCVPixelFormatType_32BGRA First I tried to resize the Ui image to 299x299 and then tried converting the UI image to ...
-2
votes
1
answer
26
views
iOS / ObjectiveC: I try to open a viewcontroller with an imageview containing a local image, but it displays a white page
I precise that when I use the debugger, I can see the image in the image view.
Why it displays a white page ? (I can see the back button)
- (void) openIMAGE:(NSIndexPath *) indexPath
{
NSString *...
0
votes
1
answer
147
views
Why can't I read EXIF from my loaded UIImage, but still can from NSData?
I have some EXIF stored in a UIImage that I store using NSFileManager writeToFile:atomically:.
Now, when I try to read back the EXIF metadata imageProperties here shows the metadata I expect:
NSData *...
1
vote
0
answers
37
views
Draw rectangle on UIImage after rotating with respect to given center
I want to draw a rotated rectangle on a UIImage where rotation will be based on a given center. My concept is to select starting coordinate of the rectangle first, then calculate the new coordinate of ...
0
votes
1
answer
101
views
`UIImage.RenderingMode.automatic` - how does it choose the actual mode?
As per Apple docs, the rendering mode of .automatic for a UIImage leads to a behavior where the image is drawn "using the context’s default rendering mode".
What is this "context's ...
-1
votes
1
answer
61
views
UITableView seems getting little bit stuck during vertical scroll
Converting downloaded image with rounded corners inside table view cell. Regarding image downloading process, used SDWebImage and making rounded corners inside completion block. So this reason feeling ...
1
vote
1
answer
70
views
How to make UIImage fully opaque so that nothing shows through from the background?
I have a UIImageView that I am making a child view of a larger UILabel, using addSubview:. Part of the image (a PNG -- using UIImage) has a transparent background and part of it does not. This is ...
3
votes
0
answers
93
views
UIGraphicsImageRenderer and UIGraphicsBeginImageContext: What is useful for UIImage.draw(in: CGRect)
I am newbie in swift and wanted to use UIImage.draw(in: CGRect) in my application to resize image. When I used UIGraphicsImageRenderer, it made some memory spikes rather than using ...
0
votes
0
answers
55
views
Is the 'subject detection' feature in iOS 16 available through a developer API in iOS?
iOS 16 includes a feature where any image can be long-pressed to 'cut out' the main subject of the image in an impressive way, Apple calls this 'subject detection' or 'subject isolation'.
Is this ...
2
votes
0
answers
104
views
Why is there a black line appearing on image loaded to UIImage, that doesn't exist in the source file?
I am trying to load images into an iOS application that are downloaded from a server. I have encountered an issue where a thin black line is appearing on the far right of the image when it's loaded ...
1
vote
2
answers
244
views
Failed to Display Image in Swift Package Manager XCAssets using UIKit
I'm currently working on Swift Package Manager project and I need to use images (myImage) I put in my custom XCAssets (CoreUI.xcassets). I have included my XCAssets in the SPM resources like this.
...
0
votes
1
answer
54
views
Change Text When UIImage in a UIImageView Animation Changes
In my app, I need to set up an animation that will run on repeat until I perform an action on it. I want both an image to change, and text change along with it. I am trying now the suggested key frame ...
2
votes
1
answer
136
views
RGB values for same image is different between phone and mac or simulator
I'm working on a task where given an image file stored locally (png/ jpg), I have to extract the rgb pixel values and input that to a different function. The problem I have faced is, the rgb values I ...