i am trying to display an image (in an UWP App) from my google photo online storage.(google photos api) When i query the photos i get an json with the following content
{
"id": "APjQy-B1s28LlE3EsrwBQL_bRyrMVpDxHFuu1-vPKwDRS6Ohgl_LzmiaQeFcvul-ZI0BwQMBOK0n-g1c............",
"productUrl": "https://photos.google.com/lr/photo/APjQy-B1s28LlE3EsrwBQL_bRyrMVpDxHFuu1-vPKwDRS6Ohgl_LzmiaQeFcvul-ZI0B................",
"baseUrl": "https://lh3.googleusercontent.com/lr/AGiIYOVIHZSM5oJ0HhAm1OzxnYy6A70ZHaDa2bS1wb6IG1Os-b0e3eEtCTKwvqojzeAmhwIRUOxT0-aMiK3VZGIVGKx_F_5rlFrOqUrFBhI62H3ZWlm8nDvOgtkzFO_ZSA103gJA6_-WDtFuRGq8QPWDyCd5Hs4okZ0jHSILkeP_91WF7W_KwSpL7W...................",
"mimeType": "image/jpeg",
"mediaMetadata": {
"creationTime": "........",
"width": "4000",
"height": "1844",
"photo": {
"cameraMake": "Xiaomi",
"cameraModel": "Mi 9 Lite",
"focalLength": 4.74,
"apertureFNumber": 1.79,
"isoEquivalent": 1654,
"exposureTime": "0.050s"
}
},
"filename": "IMG_20200207_191419.jpg"
},
when i past the productUrl in a bowser , i can see the photo. But when i try to create a bitmapimage in the code i get an exception : The component cannot be found. (Exception from HRESULT: 0x88982F50) It seems that somehow the image cannot be decoded ?!
Here is my sample code:
var uri1 = new Uri("https://image.shutterstock.com/image-photo/bright-spring-view-cameo-island-600w-1048185397.jpg");
var uri2 = new Uri("https://photos.google.com/lr/photo/APjQy-BpcVPkezt2BLsBmbHfuwHFJ0eIknFMgP8vEGLHVj9n5yBD_aX7-i6E77bA4XYuU-Hyktds4Tut...........");
IRandomAccessStreamReference thumbnail = RandomAccessStreamReference.CreateFromUri(uri2);
file = await StorageFile.CreateStreamedFileFromUriAsync("IMG_20200203_215716.jpg", uri2, thumbnail);
BitmapImage image = new BitmapImage();
using (IRandomAccessStream stream = await file.OpenReadAsync())
{
await image.SetSourceAsync(stream);
}
In the sample code you see two uri's. uri1 is working. uri2 throws the exception. Can someone help me to direct me in the right direction. I do not know where to search. Thanks in advance Chris