问题
I have an app where I download jpegs from Web, decode them and display it on Windows Phone 7.1. It works well, except for one single jpeg file. I tried the app with hundreds of jpegs and this problem occurs rarely.
BTW, I tried decoding jpegs with PictureDecoder.DecodeJpeg and ImageTools' Jpeg decoder. Both yielded the same result. %60 or %70 of the picture appears as black and the rest is normal.
Note: It's not a 2000 px limit problem. I solved that by splitting images into several pieces after I decode them.
Another Note: I checked pixel values of those black areas and they are not 0 (the initial value).
Another Note2: Using <image>
control in XAML and setting its source to the URL below works. But that's not an option for me as I need to split it into several pieces (because of 2000 px problem).
Here is a jpeg I'm having problem with: http://d24w6bsrhbeh9d.cloudfront.net/photo/1840288_700b_v1.jpg
UPDATE: After I decoded that JPEG, I encoded it again and saved it to the Isolated Local Storage and grabbed that file using Isolated Storage Explorer Tool. I could display the image thus it was decoded and encoded properly. I'm still invastigating the issue.
回答1:
Problem Solved: Reason not found
I solved the problem by decreasing the max height of my images. As Windows Phone 7 is limited by 2000 px x 2000 px, I was splitting my images accordingly. It worked for hundreds of images except few (1 in 100). And no, it was not a floating number rounding problem, all pieces had height of max. 2000 pixels. Now I decreased that max number from 2000 to below 1800 and it works. However why this happens is still a mystery to me.
来源:https://stackoverflow.com/questions/8902581/some-jpegs-not-displaying-correctly-size-limitation