lionheart / openradar-mirror

A mirror of radars pulled from http://openradar.me/.
246 stars 17 forks source link

27673422: requestImageDataForAsset returning thumbnail for filtered images #15538

Open openradar-mirror opened 8 years ago

openradar-mirror commented 8 years ago

Description

Area: Photos

Summary: Calling -[PHImageManager requestImageDataForAsset:] may return a thumbnail image in cases where:

The image returned may be a thumbnail even if delivery mode is set to PHImageRequestOptionsDeliveryModeHighQualityFormat. The info dictionary is not marked as degraded either.

Steps to Reproduce:

  1. Use the Camera app to take a photo with filter applied
  2. From an iOS app, make a requestImageDataForAsset: call to the Photos framework with options set as the following:
    PHImageRequestOptions *requestOptions = [[PHImageRequestOptions alloc] init];
    requestOptions.version = PHImageRequestOptionsVersionCurrent;
    requestOptions.networkAccessAllowed = YES;
    requestOptions.synchronous = YES;
    requestOptions.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;

Expected Results: As explained by the documentations for requestImageDataForAsset:, we expect that the resultHandler will be invoked with data containing the "full-sized image data for the specified asset".

Actual Results: We receive a thumbnail of the rendered image, with an info dict containing the following:

{
    PHImageFileDataKey = <PLXPCShMemData: 0x14587310> bufferLength=139264 dataLength=138423;
    PHImageFileOrientationKey = 0;
    PHImageFileSandboxExtensionTokenKey = "44b49d95b5b2768fd4af97cdd4463ffc29d95f51;00000000;00000000;0000001a;com.apple.app-sandbox.read;00000001;01000003;0000000000039b31;/private/var/mobile/Media/PhotoData/Mutations/DCIM/100APPLE/IMG_0019/Adjustments/SubstandardFullSizeRender.jpg";
    PHImageFileURLKey = "file:///var/mobile/Media/PhotoData/Mutations/DCIM/100APPLE/IMG_0019/Adjustments/SubstandardFullSizeRender.jpg";
    PHImageFileUTIKey = "public.jpeg";
    PHImageResultDeliveredImageFormatKey = 9988;
    PHImageResultIsDegradedKey = 0;
    PHImageResultIsInCloudKey = 0;
    PHImageResultIsPlaceholderKey = 0;
    PHImageResultOptimizedForSharing = 0;
    PHImageResultWantedImageFormatKey = 9998;
}

The size of the image received is 138423 bytes vs the actual size of 1314598 bytes. The dimensions received is 640x852, vs the actual dimension of 2448x3264.

Version: iOS 8.0, iOS 9.3.1

Notes: The attached project contains a sample project that fetches the newest asset in the Photos library twice -- once synchronously and once asynchronously after the synchronous request finishes -- and compares the results.

When a new filtered photo is taken, opening the app will show a alert regarding the mismatch sizes.

Configuration: iPhone 5

Product Version: 8.0 and above Created: 2016-08-03T06:11:25.482760 Originated: 2016-08-02T00:00:00 Open Radar Link: http://www.openradar.me/27673422

yingkong1987 commented 8 years ago

when you open the filter type take photo. and use photokit to request image data at once.

you will get SubstandardFullSizeRender.jpg , waits a few seconds. try again.

you will get FullSizeRender.jpg.

you can use the "Substandard" string to filter the first one in URL or Name