Image I/O

RSS for tag

Read and write most image file formats, manage color, access image metadata using Image I/O.

Posts under Image I/O tag

200 Posts

Post

Replies

Boosts

Views

Activity

ios17 beta UIImage encoding error
In iOS 17 beta3 and later versions, it has been observed that encoding using UIImagePNGRepresentation, manually using CGImageDestinationFinalize for encoding, or using the new UIImageHEICRepresentation, all result in color shifting issues for the corresponding images. The original data can be downloaded from https://mdn.alipayobjects.com/promo_creative/afts/img/A*RxJIQ60ntZMAAAAAAAAAAAAAAVR1AQ/original. Could you please help investigate the cause of this issue?
0
0
811
Aug ’23
Save texture as Tiff
I'm trying to save metal textures in a lossless compressed format. I've tried png and tiff, but I run into the same problem: the pixel data changes after save and load when we have transparency. Here is the code I use to save a Tiff: import ImageIO import UIKit import Metal import MobileCoreServices extension MTLTexture { func saveAsLosslessTIFF(url: URL) throws { guard let context = CIContext() else { return } guard let colorSpace = CGColorSpace(name: CGColorSpace.linearSRGB) else { return } guard let ciImage = CIImage(mtlTexture: self, options: [.colorSpace : colorSpace]) else { return } guard let cgImage = context.createCGImage(ciImage, from: ciImage.extent) else { return } // create a dictionary with TIFF compression options let tiffCompression_LZW = 5 let options: [String: Any] = [ kCGImagePropertyTIFFCompression as String: tiffCompression_LZW, kCGImagePropertyDepth as String: depth, kCGImagePropertyPixelWidth as String: width, kCGImagePropertyPixelHeight as String: height, ] let fileDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeTIFF, 1, nil) guard let destination = fileDestination else { throw RuntimeError("Unable to create image destination.") } CGImageDestinationAddImage(destination, cgImage, options as CFDictionary) if !CGImageDestinationFinalize(destination) { throw RuntimeError("Unable to save image to destination.") } } } I can then load the texture like this: func loadTexture(url:URL) throws -> MTLTexture { let usage = MTLTextureUsage(rawValue: MTLTextureUsage.renderTarget.rawValue | MTLTextureUsage.shaderRead.rawValue | MTLTextureUsage.shaderWrite.rawValue) return try loader.newTexture(URL:url,options:[MTKTextureLoader.Option.textureUsage:usage.rawValue,MTKTextureLoader.Option.origin:MTKTextureLoader.Origin.flippedVertically.rawValue]) } After saving and then loading the texture again, I want to get back the exact same texture. And I do, if there is no transparency. Transparent pixels, however, are transformed in a way that I don't understand. Here is an example pixel: [120, 145, 195, 170] -> [144, 174, 234, 170] My first guess would be that something is trying to undo a pre-multiplied alpha that never happened. But the numbers don't seem to work out. For example, if that were the case I'd expect 120 to go to (120 * 255) / 170 = 180 , not 144. Any idea what I am doing wrong?
9
0
1.7k
Aug ’23
Optimizing loading lots of small images in iOS App - My attempt
In my iOS app, I need to load and display lots of small images like icons and thumbnails. This was causing slow loading and high memory usage issues. I tried optimizing by encoding the images to Base64 strings and embedding them directly in code. Here's a Swift code snippet to demonstrate: let imageData = UIImage(named:"image.png")!.pngData()! let base64String = imageData.base64EncodedString() let imgBase64 = "data:image/png;base64,\(base64String)" let image = UIImage(data: Data(base64Encoded: imgBase64)!) This improved the app's performance - loading speed increased by 2x and memory usage decreased by 30%. Way better than loading individual image files! Curious to know if anyone else has tried Base64 image loading? Are there other optimization techniques you'd recommend? I'm interested to learn more approaches to smooth image loading in iOS apps. Btw, this blog post gave me the idea to try Base64 encoding for faster image loading. Recommend checking it out for more techniques! https://itoolkit.co/blog/2023/08/improve-page-speed-and-seo-with-base64-encoding-images/
2
0
997
Aug ’23
how to produce image with semanticSegmentationSkyMatteImage information on iOS?
I'm trying to create a sky mask on pictures taken from my iPhone. I've seen in the documentation that CoreImage support semantic segmentation for Sky among other type for person (skin, hair etc...) For now, I didn't found the proper workflow to use it. First, I watched https://developer.apple.com/videos/play/wwdc2019/225/ I understood that images must be captured with the segmentation with this kind of code: photoSettings.enabledSemanticSegmentationMatteTypes = self.photoOutput.availableSemanticSegmentationMatteTypes photoSettings.embedsSemanticSegmentationMattesInPhoto = true I capture the image on my iPhone, save it as HEIC format then later, I try to load the matte like that : let skyMatte = CIImage(contentsOf: imageURL, options: [.auxiliarySemanticSegmentationSkyMatte: true]) Unfortunately, self.photoOutput.availableSemanticSegmentationMatteTypes always give me a list of types for person only and never a types Sky. Anyway, the AVSemanticSegmentationMatte.MatteType is just [Hair, Skin, Teeth, Glasses] ... No Sky !!! So, How am I supposed to use semanticSegmentationSkyMatteImage ?!? Is there any simple workaround ?
1
1
994
Aug ’23
Swift: Save image with file name using PHPhotoLibrary and PHAssetCreationRequest
I  am trying to save an image to the user's photo library using PHPhotoLibrary and set the image file name at the time of saving suing the code below. This is working the first time, but if I then try to save the same image again with a different file name, it saves with the same file name as before. Is there something I need to add to let the system know to save a new version of the image with a new file name? Thank you PHPhotoLibrary.shared().performChanges ({ let assetType:PHAssetResourceType = .photo let request:PHAssetCreationRequest = .forAsset() let createOptions:PHAssetResourceCreationOptions = PHAssetResourceCreationOptions() createOptions.originalFilename = "\(fileName)" request.addResource(with: assetType, data: image.jpegData(compressionQuality: 1)!, options: createOptions) }, completionHandler: { success, error in if success == true && error == nil { print("Success saving image") } else { print("Error saving image: \(error!.localizedDescription)") } })
3
0
2.7k
Aug ’23
Strange chinese character next to the iPhone folder name and different format of images
I was wondering if anyone has same problem. When i plug the iphone to my windows laptop the folders in iphone showing a chinese word next to the folder name. Also images format having different type of word and when i copy them to the windows, it doesn't recognize them as images. I have already erase the iphone and when plug again, same issue is there. Please refer attached two pics. I'm running IOS 17 public beta.
10
2
4.1k
Aug ’23
Loading NSImage from icns file takes very long for Visual Studio Code icon
I am trying to load an app icon from an icns file. I am using the following code: guard let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "com.microsoft.VSCode") else { return nil } let icon = NSWorkspace.shared.icon(forFile: url.path) This seems to work very fine for all apps that I tested. All of them? No. Loading the icon for Visual Studio Code takes 4-5 seconds. Are there any other, faster methods? I also tried to use NSImage(contentsOfFile: url.path) which also takes very long. I have uploaded the icns file here: https://sascha-simon.com/Code.icns How can this behavior be explained?
4
0
1.4k
Aug ’23
Suppress CoreGraphics or Image I/O Console Messages
I'm using CoreGraphics and Image I/O in a MacOS command-line tool. My program works fine, but after the first drawing to a bitmap context there are messages output to the console like the following: 2022-12-20 16:33:47.824937-0500 RandomImageGenerator[4436:90170] Metal API Validation Enabled AVEBridge Info: AVEEncoder_CreateInstance: Received CreateInstance (from VT) AVEBridge Info: connectHandler: Device connected (0x000000010030b520)Assert - (remoteService != NULL) - f: /AppleInternal/Library/BuildRoots/43362d89-619c-11ed-a949-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/AppleAVEBridge/AppleAVEEncoder/AppleAVEEncoder.c l: 291 AVE XPC Error: could not find remote service Assert - (err == noErr) - f: /AppleInternal/Library/BuildRoots/43362d89-619c-11ed-a949-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/AppleAVEBridge/AppleAVEEncoder/AppleAVEEncoder.c l: 1961 AVE ERROR: XPC failed AVEBridge Info: stopUserClient: IOServiceClose was successful. AVEBridge Error: AVEEncoder_CreateInstance: returning err = -12908 These messages get in the way of my own console output. How do I stop these messages from being displayed? This post on StackOverflow (https://stackoverflow.com/questions/37800790/hide-strange-unwanted-xcode-logs) does not appear to be relevant to this issue.
1
1
1.6k
Aug ’23
Image not visible in SwiftUI project
Hello everyone, I'm facing an issue with my SwiftUI project, and I would appreciate some help in resolving it. The problem is that one of the images in my project is not visible when I use it in my code. Here are the details of the issue: I have for example two images, "AIOx2.png" and "AIOx3.png", both of which are placed in the "Assets.xcassets" folder of my Xcode project. When I use "AIOx3.png" in my SwiftUI code (e.g., replacing Image("AIOx2") with Image("AIOx3")), the image is visible on the preview canvas and simulator. However, when I use "AIOx2.png" in the same way, the image is not visible on the preview canvas or the simulator. I have verified that the file "AIOx2.png" is correctly named and is in the same location as "AIOx3.png" in the "Assets.xcassets" folder. There are no error messages or warnings related to the image in the Xcode console. I have tried several troubleshooting steps, such as cleaning and build, restarting Xcode, re-downloading and re-adding the image to the project, but the issue persists. Is there anything specific that I might be missing or any other suggestions for troubleshooting this problem? I would be grateful for any guidance or insights into resolving this issue. Thank you in advance for your help! Best regards, Adam
2
0
2.4k
Jul ’23
SceneKit Xcode 15 Beta3
Previously art work used and porting a complex 3D mechanical Clock I am running into constant build errors using my previous art work .scn files I had some success converting my .usdz original to .scn file some convert but most just being in the art folder of the build environment cause this crash and are no longer compatible I use the same art work of gears and parts in UNITY build environment without any build issues most of my clocks have up to 35 different interacting parts These are replicas of classical clock mechanism Is any one else having problems with similar .scn files [?]
1
0
1.2k
Jul ’23
HEIF10 representation doesn't contain alpha channel
When using the heif10Representation and writeHEIF10Representation APIs of CIContext, the resulting image doesn’t contain an alpha channel. When using the heifRepresentation and writeHEIFRepresentation APIs, the alpha channel is properly preserved, i.e., the resulting HEIC will contain a urn:mpeg:hevc:2015:auxid:1 auxiliary image. This image is missing when exporting as HEIF10. Is this a bug or is this intentional? If I understand the spec correctly, HEIF10 should be able to support alpha via auxiliary image (like HEIF8).
1
0
1.1k
Jul ’23
Xcode 15 Beta3 sceneKit templet
I am getting 4 warnings compiling the current template of sceneKit game /Users/helmut/Documents/spaceTime/scntool:1:1 Could not find bundle inside /Library/Developer/CommandLineTools any idea why the bundle is not installed I did a new download twice now still stuck getting these warnings about bundles not installed or not found any solution to correct the download install so the base dependencies are present thank you
0
0
991
Jul ’23
SVG Assets: Load Downsampled version in UIImage
Hi, I have some SVG assets that are natively in 512x512 resolution. I want to use 20 of them in a Widget context where memory consumption must be kept low (due to 30MB Memory limit in extensions). As in that widget context, the images are display in small size (they are displayed in full size in the app) I would like to load a downsampled version of the images (let say 32x32). Is there any way to achieve that? (perhaps with configuration or traitCollection) I could resize them after having loading them full size but it will nevertheless create a memory peak consumption while resizing all the images... Thanks in advance for the help. PS: I really want to avoid to generate smaller preview images just for that purpose but if I can't find a better solution I could ask the app to generate thumbs for all images at first startup and use these thumbs in the widgets... Clement
0
0
1.1k
Jul ’23
'Color' cannot be constructed
Hi all, I got an error: 'Color' cannot be constructed because it has no accessible initializers. The error I get from the statement: .background(Color(uiColor: UIColor(red: 0.93, green: 0.93, blue: 0.94, alpha: 1.00))) I always use it but it's failed now. Is there anyone have the same issues? Please give me an advice of how I can fix it. Thanks
2
0
1.3k
Jun ’23
Got unsupported file format 'org.webmproject.webp' when download PNG file from https url
ImageSaver class: class ImageSaver: NSObject { var successHandler: (() -> Void)? var errorHandler: ((Error) -> Void)? func writeToPhotoAlbum(image: UIImage) { UIImageWriteToSavedPhotosAlbum(image, self, #selector(saveCompleted), nil) } @objc func saveCompleted(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) { if let error = error { errorHandler?(error) } else { successHandler?() } } } button action to trigger the download of a png file from URL: Button{ let imageSaver = ImageSaver() imageSaver.successHandler = { print("Success!") } imageSaver.errorHandler = { print("Oops: \($0.localizedDescription)") } let imageRequestUrl = URL(string: lastImageUrl)! // I'm sure that I can see the image url is valid and I can // downloaded it from Google chrome successfully print("imageRequestUrl:\(imageRequestUrl)") let req = URLRequest(url: imageRequestUrl) let task = URLSession.shared.dataTask(with: req) { d, res, err in if let data = d, let image = UIImage(data: data) { imageSaver.writeToPhotoAlbum(image: image) } } task.resume() } And this is the error: findWriterForTypeAndAlternateType:119: unsupported file format 'org.webmproject.webp' More info When I change the image URL to another one, like some other open-source png file, there's no error.... please help why it's so weird?
1
0
1.2k
Jun ’23
iOS 16 can not display PDF file if using gradient.
In iOS 16, can not displaying PDF included gradients. PDF displayed normally if used Radial or Linear Gradient. Complex shape gradients are not displayed. The PDF is not displayed inside the iOS-application resources and when open file in iPhone use Files app normally. Attached an example with a regular Diamond gradient, which was created use Figma. iOS 15 displays the example file correctly. You can open file if change file format: Example.json rename to -> Example.pdf. P.S. I can't attached pdf or zip files. Example.json
0
2
2.2k
Jun ’23
ios17 beta UIImage encoding error
In iOS 17 beta3 and later versions, it has been observed that encoding using UIImagePNGRepresentation, manually using CGImageDestinationFinalize for encoding, or using the new UIImageHEICRepresentation, all result in color shifting issues for the corresponding images. The original data can be downloaded from https://mdn.alipayobjects.com/promo_creative/afts/img/A*RxJIQ60ntZMAAAAAAAAAAAAAAVR1AQ/original. Could you please help investigate the cause of this issue?
Replies
0
Boosts
0
Views
811
Activity
Aug ’23
Save texture as Tiff
I'm trying to save metal textures in a lossless compressed format. I've tried png and tiff, but I run into the same problem: the pixel data changes after save and load when we have transparency. Here is the code I use to save a Tiff: import ImageIO import UIKit import Metal import MobileCoreServices extension MTLTexture { func saveAsLosslessTIFF(url: URL) throws { guard let context = CIContext() else { return } guard let colorSpace = CGColorSpace(name: CGColorSpace.linearSRGB) else { return } guard let ciImage = CIImage(mtlTexture: self, options: [.colorSpace : colorSpace]) else { return } guard let cgImage = context.createCGImage(ciImage, from: ciImage.extent) else { return } // create a dictionary with TIFF compression options let tiffCompression_LZW = 5 let options: [String: Any] = [ kCGImagePropertyTIFFCompression as String: tiffCompression_LZW, kCGImagePropertyDepth as String: depth, kCGImagePropertyPixelWidth as String: width, kCGImagePropertyPixelHeight as String: height, ] let fileDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeTIFF, 1, nil) guard let destination = fileDestination else { throw RuntimeError("Unable to create image destination.") } CGImageDestinationAddImage(destination, cgImage, options as CFDictionary) if !CGImageDestinationFinalize(destination) { throw RuntimeError("Unable to save image to destination.") } } } I can then load the texture like this: func loadTexture(url:URL) throws -> MTLTexture { let usage = MTLTextureUsage(rawValue: MTLTextureUsage.renderTarget.rawValue | MTLTextureUsage.shaderRead.rawValue | MTLTextureUsage.shaderWrite.rawValue) return try loader.newTexture(URL:url,options:[MTKTextureLoader.Option.textureUsage:usage.rawValue,MTKTextureLoader.Option.origin:MTKTextureLoader.Origin.flippedVertically.rawValue]) } After saving and then loading the texture again, I want to get back the exact same texture. And I do, if there is no transparency. Transparent pixels, however, are transformed in a way that I don't understand. Here is an example pixel: [120, 145, 195, 170] -> [144, 174, 234, 170] My first guess would be that something is trying to undo a pre-multiplied alpha that never happened. But the numbers don't seem to work out. For example, if that were the case I'd expect 120 to go to (120 * 255) / 170 = 180 , not 144. Any idea what I am doing wrong?
Replies
9
Boosts
0
Views
1.7k
Activity
Aug ’23
Optimizing loading lots of small images in iOS App - My attempt
In my iOS app, I need to load and display lots of small images like icons and thumbnails. This was causing slow loading and high memory usage issues. I tried optimizing by encoding the images to Base64 strings and embedding them directly in code. Here's a Swift code snippet to demonstrate: let imageData = UIImage(named:"image.png")!.pngData()! let base64String = imageData.base64EncodedString() let imgBase64 = "data:image/png;base64,\(base64String)" let image = UIImage(data: Data(base64Encoded: imgBase64)!) This improved the app's performance - loading speed increased by 2x and memory usage decreased by 30%. Way better than loading individual image files! Curious to know if anyone else has tried Base64 image loading? Are there other optimization techniques you'd recommend? I'm interested to learn more approaches to smooth image loading in iOS apps. Btw, this blog post gave me the idea to try Base64 encoding for faster image loading. Recommend checking it out for more techniques! https://itoolkit.co/blog/2023/08/improve-page-speed-and-seo-with-base64-encoding-images/
Replies
2
Boosts
0
Views
997
Activity
Aug ’23
how to produce image with semanticSegmentationSkyMatteImage information on iOS?
I'm trying to create a sky mask on pictures taken from my iPhone. I've seen in the documentation that CoreImage support semantic segmentation for Sky among other type for person (skin, hair etc...) For now, I didn't found the proper workflow to use it. First, I watched https://developer.apple.com/videos/play/wwdc2019/225/ I understood that images must be captured with the segmentation with this kind of code: photoSettings.enabledSemanticSegmentationMatteTypes = self.photoOutput.availableSemanticSegmentationMatteTypes photoSettings.embedsSemanticSegmentationMattesInPhoto = true I capture the image on my iPhone, save it as HEIC format then later, I try to load the matte like that : let skyMatte = CIImage(contentsOf: imageURL, options: [.auxiliarySemanticSegmentationSkyMatte: true]) Unfortunately, self.photoOutput.availableSemanticSegmentationMatteTypes always give me a list of types for person only and never a types Sky. Anyway, the AVSemanticSegmentationMatte.MatteType is just [Hair, Skin, Teeth, Glasses] ... No Sky !!! So, How am I supposed to use semanticSegmentationSkyMatteImage ?!? Is there any simple workaround ?
Replies
1
Boosts
1
Views
994
Activity
Aug ’23
Swift: Save image with file name using PHPhotoLibrary and PHAssetCreationRequest
I  am trying to save an image to the user's photo library using PHPhotoLibrary and set the image file name at the time of saving suing the code below. This is working the first time, but if I then try to save the same image again with a different file name, it saves with the same file name as before. Is there something I need to add to let the system know to save a new version of the image with a new file name? Thank you PHPhotoLibrary.shared().performChanges ({ let assetType:PHAssetResourceType = .photo let request:PHAssetCreationRequest = .forAsset() let createOptions:PHAssetResourceCreationOptions = PHAssetResourceCreationOptions() createOptions.originalFilename = "\(fileName)" request.addResource(with: assetType, data: image.jpegData(compressionQuality: 1)!, options: createOptions) }, completionHandler: { success, error in if success == true && error == nil { print("Success saving image") } else { print("Error saving image: \(error!.localizedDescription)") } })
Replies
3
Boosts
0
Views
2.7k
Activity
Aug ’23
Strange chinese character next to the iPhone folder name and different format of images
I was wondering if anyone has same problem. When i plug the iphone to my windows laptop the folders in iphone showing a chinese word next to the folder name. Also images format having different type of word and when i copy them to the windows, it doesn't recognize them as images. I have already erase the iphone and when plug again, same issue is there. Please refer attached two pics. I'm running IOS 17 public beta.
Replies
10
Boosts
2
Views
4.1k
Activity
Aug ’23
Loading NSImage from icns file takes very long for Visual Studio Code icon
I am trying to load an app icon from an icns file. I am using the following code: guard let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "com.microsoft.VSCode") else { return nil } let icon = NSWorkspace.shared.icon(forFile: url.path) This seems to work very fine for all apps that I tested. All of them? No. Loading the icon for Visual Studio Code takes 4-5 seconds. Are there any other, faster methods? I also tried to use NSImage(contentsOfFile: url.path) which also takes very long. I have uploaded the icns file here: https://sascha-simon.com/Code.icns How can this behavior be explained?
Replies
4
Boosts
0
Views
1.4k
Activity
Aug ’23
Suppress CoreGraphics or Image I/O Console Messages
I'm using CoreGraphics and Image I/O in a MacOS command-line tool. My program works fine, but after the first drawing to a bitmap context there are messages output to the console like the following: 2022-12-20 16:33:47.824937-0500 RandomImageGenerator[4436:90170] Metal API Validation Enabled AVEBridge Info: AVEEncoder_CreateInstance: Received CreateInstance (from VT) AVEBridge Info: connectHandler: Device connected (0x000000010030b520)Assert - (remoteService != NULL) - f: /AppleInternal/Library/BuildRoots/43362d89-619c-11ed-a949-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/AppleAVEBridge/AppleAVEEncoder/AppleAVEEncoder.c l: 291 AVE XPC Error: could not find remote service Assert - (err == noErr) - f: /AppleInternal/Library/BuildRoots/43362d89-619c-11ed-a949-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/AppleAVEBridge/AppleAVEEncoder/AppleAVEEncoder.c l: 1961 AVE ERROR: XPC failed AVEBridge Info: stopUserClient: IOServiceClose was successful. AVEBridge Error: AVEEncoder_CreateInstance: returning err = -12908 These messages get in the way of my own console output. How do I stop these messages from being displayed? This post on StackOverflow (https://stackoverflow.com/questions/37800790/hide-strange-unwanted-xcode-logs) does not appear to be relevant to this issue.
Replies
1
Boosts
1
Views
1.6k
Activity
Aug ’23
Image not visible in SwiftUI project
Hello everyone, I'm facing an issue with my SwiftUI project, and I would appreciate some help in resolving it. The problem is that one of the images in my project is not visible when I use it in my code. Here are the details of the issue: I have for example two images, "AIOx2.png" and "AIOx3.png", both of which are placed in the "Assets.xcassets" folder of my Xcode project. When I use "AIOx3.png" in my SwiftUI code (e.g., replacing Image("AIOx2") with Image("AIOx3")), the image is visible on the preview canvas and simulator. However, when I use "AIOx2.png" in the same way, the image is not visible on the preview canvas or the simulator. I have verified that the file "AIOx2.png" is correctly named and is in the same location as "AIOx3.png" in the "Assets.xcassets" folder. There are no error messages or warnings related to the image in the Xcode console. I have tried several troubleshooting steps, such as cleaning and build, restarting Xcode, re-downloading and re-adding the image to the project, but the issue persists. Is there anything specific that I might be missing or any other suggestions for troubleshooting this problem? I would be grateful for any guidance or insights into resolving this issue. Thank you in advance for your help! Best regards, Adam
Replies
2
Boosts
0
Views
2.4k
Activity
Jul ’23
SceneKit Xcode 15 Beta3
Previously art work used and porting a complex 3D mechanical Clock I am running into constant build errors using my previous art work .scn files I had some success converting my .usdz original to .scn file some convert but most just being in the art folder of the build environment cause this crash and are no longer compatible I use the same art work of gears and parts in UNITY build environment without any build issues most of my clocks have up to 35 different interacting parts These are replicas of classical clock mechanism Is any one else having problems with similar .scn files [?]
Replies
1
Boosts
0
Views
1.2k
Activity
Jul ’23
HEIF10 representation doesn't contain alpha channel
When using the heif10Representation and writeHEIF10Representation APIs of CIContext, the resulting image doesn’t contain an alpha channel. When using the heifRepresentation and writeHEIFRepresentation APIs, the alpha channel is properly preserved, i.e., the resulting HEIC will contain a urn:mpeg:hevc:2015:auxid:1 auxiliary image. This image is missing when exporting as HEIF10. Is this a bug or is this intentional? If I understand the spec correctly, HEIF10 should be able to support alpha via auxiliary image (like HEIF8).
Replies
1
Boosts
0
Views
1.1k
Activity
Jul ’23
Xcode 15 Beta3 sceneKit templet
I am getting 4 warnings compiling the current template of sceneKit game /Users/helmut/Documents/spaceTime/scntool:1:1 Could not find bundle inside /Library/Developer/CommandLineTools any idea why the bundle is not installed I did a new download twice now still stuck getting these warnings about bundles not installed or not found any solution to correct the download install so the base dependencies are present thank you
Replies
0
Boosts
0
Views
991
Activity
Jul ’23
SVG Assets: Load Downsampled version in UIImage
Hi, I have some SVG assets that are natively in 512x512 resolution. I want to use 20 of them in a Widget context where memory consumption must be kept low (due to 30MB Memory limit in extensions). As in that widget context, the images are display in small size (they are displayed in full size in the app) I would like to load a downsampled version of the images (let say 32x32). Is there any way to achieve that? (perhaps with configuration or traitCollection) I could resize them after having loading them full size but it will nevertheless create a memory peak consumption while resizing all the images... Thanks in advance for the help. PS: I really want to avoid to generate smaller preview images just for that purpose but if I can't find a better solution I could ask the app to generate thumbs for all images at first startup and use these thumbs in the widgets... Clement
Replies
0
Boosts
0
Views
1.1k
Activity
Jul ’23
'Color' cannot be constructed
Hi all, I got an error: 'Color' cannot be constructed because it has no accessible initializers. The error I get from the statement: .background(Color(uiColor: UIColor(red: 0.93, green: 0.93, blue: 0.94, alpha: 1.00))) I always use it but it's failed now. Is there anyone have the same issues? Please give me an advice of how I can fix it. Thanks
Replies
2
Boosts
0
Views
1.3k
Activity
Jun ’23
why the photos taken using iphone 14 plus from a distance of 20 meter is unable to get clear vehicle license number
I was trying to take an image of a car that includes the license plate. But later when I checked the numbers in the license plate is not clear and readable. When I did a zoom there are slanting lines in place. Is there any settings available to avoid?
Replies
1
Boosts
0
Views
965
Activity
Jun ’23
Got unsupported file format 'org.webmproject.webp' when download PNG file from https url
ImageSaver class: class ImageSaver: NSObject { var successHandler: (() -> Void)? var errorHandler: ((Error) -> Void)? func writeToPhotoAlbum(image: UIImage) { UIImageWriteToSavedPhotosAlbum(image, self, #selector(saveCompleted), nil) } @objc func saveCompleted(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) { if let error = error { errorHandler?(error) } else { successHandler?() } } } button action to trigger the download of a png file from URL: Button{ let imageSaver = ImageSaver() imageSaver.successHandler = { print("Success!") } imageSaver.errorHandler = { print("Oops: \($0.localizedDescription)") } let imageRequestUrl = URL(string: lastImageUrl)! // I'm sure that I can see the image url is valid and I can // downloaded it from Google chrome successfully print("imageRequestUrl:\(imageRequestUrl)") let req = URLRequest(url: imageRequestUrl) let task = URLSession.shared.dataTask(with: req) { d, res, err in if let data = d, let image = UIImage(data: data) { imageSaver.writeToPhotoAlbum(image: image) } } task.resume() } And this is the error: findWriterForTypeAndAlternateType:119: unsupported file format 'org.webmproject.webp' More info When I change the image URL to another one, like some other open-source png file, there's no error.... please help why it's so weird?
Replies
1
Boosts
0
Views
1.2k
Activity
Jun ’23
[Unknown process name] CGImageCreate: invalid image byte order info for bitsPerPixel != 32 = 16384
Environment Xcode 14 ios 16 Error [Unknown process name] CGImageCreate: invalid image byte order info for bitsPerPixel != 32 = 16384 And when I run my app in iphone, it can't show the image of result. It seems that there are some bugs when running in ios 16. How can I solve this problem?
Replies
2
Boosts
1
Views
1.5k
Activity
Jun ’23
how to get referrar parameter from appstore url(iOS)?
Example : android url : https://play.google.com/store/apps/details?id=com.moevd.android.user&referrer=t=u&c=Azhar Android getting this referrer from play store by google Analytics . how this possible for iOS ? like how can we get referrer from App Store ? how related google analytics to Apple Store? info given above.
Replies
0
Boosts
0
Views
892
Activity
Jun ’23
iOS 16 can not display PDF file if using gradient.
In iOS 16, can not displaying PDF included gradients. PDF displayed normally if used Radial or Linear Gradient. Complex shape gradients are not displayed. The PDF is not displayed inside the iOS-application resources and when open file in iPhone use Files app normally. Attached an example with a regular Diamond gradient, which was created use Figma. iOS 15 displays the example file correctly. You can open file if change file format: Example.json rename to -> Example.pdf. P.S. I can't attached pdf or zip files. Example.json
Replies
0
Boosts
2
Views
2.2k
Activity
Jun ’23
How to operate a image file
Excuse me, it may be a fool question. But how to load an image, access to its pixels and save it to disk. I used to programming in C++ via OpenCV. And I'm a new player in swift. Thanks!
Replies
2
Boosts
0
Views
861
Activity
May ’23