how to get bitmap data from jpg file on wp7
is there any library which can help me with getting single pixels from JPG file loaded from Phone media library on WP7? I need to access to single pixels, but now I am only able to get whole file into byte array or access to these bytes through memory stream. Any ideas? I found FJcore but I can´t use it because of reflections...
Here is what I´ve got:
byte[] contents = new byte[e.ChosenPhoto.Length];
MemoryStream fullFileStream = new MemoryStream();
int bytes;
while ((bytes = e.ChosenPhoto.Read(contents, 0, contents.Length)) > 0)
{
fullFileStream.Write(contents, 0, bytes);
}
And I need some library wi开发者_如何学JAVAth method like GetPixels() to access to single pixels from loaded image.
Thanks
Use WritableBitmap.Pixels. Pixel manipulation in Silverlight for Windows Phone 7 sometimes sufferers sluggish performance - consider using XNA.
http://writeablebitmapex.codeplex.com/ includes a GetPixel
method which sounds just like what you need.
Update
Based on the comments you've made to other answers, I think you need to conider a different approach. The 2000 pixel limit is a framework limitation designed to try and preserve performance by not including framework elements which are significantly larger than the screen size.
If your images are 10k x 10k pixels then you should seriously consider processing them off the device and then only loading smaller versions or subsections onto the actual device.
精彩评论