开发者

how to get bitmap data from jpg file on wp7

开发者 https://www.devze.com 2023-02-21 20:38 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消