PHImageManager.requestImage doesn't provide the proper size of images
Originator: | Koichi.Sato.aow | ||
Number: | rdar://FB9645036 | Date Originated: | Sep 21, 2021 |
Status: | Open | Resolved: | |
Product: | iOS | Product Version: | iOS 15.0 |
Classification: | Photos | Reproducible: | Every time |
- A clear description of the problem We are trying to get a square image of a PHAsset with PHImageManager. The result image should be the center square of the image. We are using a method PHImageManager.requestImage(for:targetSize:contentMode:options:resultHandler:) , described in https://developer.apple.com/documentation/photokit/phimagemanager/1616964-requestimage . However, it doesn't return the target size image in iOS 15, although it works fine in older OSs. - A step-by-step set of instructions to reproduce the problem (if possible) 1. prepare a PHAsset of non-square such as 4032x3024. 2. initialize options like ``` let options = PHImageRequestOptions() options.resizeMode = .exact options.deliveryMode = .highQualityFormat options.isNetworkAccessAllowed = true options.progressHandler = { (progress, _, _, _) in } ``` 3. request the image with PHImageManager like ``` PHImageManager.default() .requestImage(for: asset, targetSize: CGSize(width: 1536, height: 1536), contentMode: .aspectFill, options: options, resultHandler: { (image, info) in // the size of image returned here is 2048.0 * 1536.0 } ``` 4. the returned image is not square as mentioned in the previous step. - What results you expected I'm expecting the size of the returned image is 1536 * 1536. - What results you actually saw the image is returned with the size of 2048.0 * 1536.0
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!