Post

Replies

Boosts

Views

Activity

“unsupported file format 'org.webmproject.webp'” while saving CGImage in webp format
Currently, we are using PHPickerViewController + CGImage for efficient memory usage consideration - https://christianselig.com/2020/09/phpickerviewcontroller-efficiently/ However, we are getting "unsupported file format 'org.webmproject.webp'" error, while trying to save CGImage in webp format. func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { picker.dismiss(animated: true) guard !results.isEmpty else { return } for result in results { result.itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.image.identifier) { (url, error) in guard let url = url else { return } let options: [CFString: Any] = [ kCGImageSourceCreateThumbnailFromImageAlways: true, kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceShouldCacheImmediately: true, kCGImageSourceThumbnailMaxPixelSize: 512 ] guard let imageSource = CGImageSourceCreateWithURL(url as NSURL, nil) else { return } let image = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary) // // No issue in dealing with UTType.jpeg.identifier and UTType.png.identifier. // destUrl is type URL. // guard let destination = CGImageDestinationCreateWithURL(destUrl as CFURL, UTType.webP.identifier, 1, nil) else { return } CGImageDestinationAddImage(destination, image!, nil) CGImageDestinationFinalize(destination) } } We face no issue in saving CGImage in UTType.jpeg.identifier format and UTType.png.identifier format. May I know how can we save CGImage in webp format without issue? Thank you.
1
1
1.1k
Aug ’21
Is it possible to make PHPickerViewController display multiple selection ordering number, instead of just an tick icon?
Currently, if we perform multiple selection on PHPickerViewController, a tick icon is being used to indicate selection. https://i.imgur.com/KCaSF9p.png However, such information doesn't convey information for the selection ordering. Is it every possible, to display the ordering number? This is an example from 3rd party library - https://github.com/mikaoj/BSImagePicker As you can see, the 3rd party library is using 1,2,3... to convey selection ordering information https://i.imgur.com/YoQVS4v.png Can we achieve the same behavior in PHPickerViewController? We prefer to use PHPickerViewController, because it doesn't need to request permission to access photo library. Thanks.
1
0
854
Aug ’21
“unsupported file format 'org.webmproject.webp'” while saving CGImage in webp format
Currently, we are using PHPickerViewController + CGImage for efficient memory usage consideration - https://christianselig.com/2020/09/phpickerviewcontroller-efficiently/ However, we are getting "unsupported file format 'org.webmproject.webp'" error, while trying to save CGImage in webp format. func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { picker.dismiss(animated: true) guard !results.isEmpty else { return } for result in results { result.itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.image.identifier) { (url, error) in guard let url = url else { return } let options: [CFString: Any] = [ kCGImageSourceCreateThumbnailFromImageAlways: true, kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceShouldCacheImmediately: true, kCGImageSourceThumbnailMaxPixelSize: 512 ] guard let imageSource = CGImageSourceCreateWithURL(url as NSURL, nil) else { return } let image = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary) // // No issue in dealing with UTType.jpeg.identifier and UTType.png.identifier. // destUrl is type URL. // guard let destination = CGImageDestinationCreateWithURL(destUrl as CFURL, UTType.webP.identifier, 1, nil) else { return } CGImageDestinationAddImage(destination, image!, nil) CGImageDestinationFinalize(destination) } } We face no issue in saving CGImage in UTType.jpeg.identifier format and UTType.png.identifier format. May I know how can we save CGImage in webp format without issue? Thank you.
Replies
1
Boosts
1
Views
1.1k
Activity
Aug ’21
Is it possible to make PHPickerViewController display multiple selection ordering number, instead of just an tick icon?
Currently, if we perform multiple selection on PHPickerViewController, a tick icon is being used to indicate selection. https://i.imgur.com/KCaSF9p.png However, such information doesn't convey information for the selection ordering. Is it every possible, to display the ordering number? This is an example from 3rd party library - https://github.com/mikaoj/BSImagePicker As you can see, the 3rd party library is using 1,2,3... to convey selection ordering information https://i.imgur.com/YoQVS4v.png Can we achieve the same behavior in PHPickerViewController? We prefer to use PHPickerViewController, because it doesn't need to request permission to access photo library. Thanks.
Replies
1
Boosts
0
Views
854
Activity
Aug ’21