bitmapimage

Can I get a byte[] from a BitmapImage in Silverlight?

a 夏天 提交于 2019-12-22 05:32:02
问题 I'm trying to pass some representation of an image back and forth between Silverlight and a WCF service. If possible I'd like to pass a System.Windows.Media.Imaging.BitmapImage , since that would mean the client doesn't have to do any conversion. However, at some point I need to store this image in a database, meaning the image representation must be able to convert to and from byte[] . I can create a BitmapImage from a byte[] by reading the array into a MemoryStream and using BitmapImage

Can I get a byte[] from a BitmapImage in Silverlight?

偶尔善良 提交于 2019-12-22 05:31:39
问题 I'm trying to pass some representation of an image back and forth between Silverlight and a WCF service. If possible I'd like to pass a System.Windows.Media.Imaging.BitmapImage , since that would mean the client doesn't have to do any conversion. However, at some point I need to store this image in a database, meaning the image representation must be able to convert to and from byte[] . I can create a BitmapImage from a byte[] by reading the array into a MemoryStream and using BitmapImage

Scale image without losing image quality did not work

送分小仙女□ 提交于 2019-12-22 05:22:07
问题 Does anyone know how to scale the bitmap image without losing the image quality ? Currently I facing this problem, where the size of selected image maybe too big caused the app return to another activity. So now I tried using this method to scale the selected image without losing its quality. I get the code from here. protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RESULT_LOAD

how to compress Uri image to bitmap

有些话、适合烂在心里 提交于 2019-12-21 18:12:11
问题 this code show me an error i want to add selected image save to database and retrive i follow this 2 tutorials http://nizaqatali.wordpress.com/2011/06/21/android-dialog-select-image-from-gallery/ and this http://androidhub4you.blogspot.com/2012/09/hello-friends-today-i-am-going-to-share.html but this problem is come error message"The method compress(Bitmap.CompressFormat, int, ByteArrayOutputStream) is undefined for the type Uri" import org.apache.http.NameValuePair; import org.apache.http

C# copy paste an image region into another image

血红的双手。 提交于 2019-12-20 18:15:14
问题 I am trying to write an utility class that permits automatic resizing of images that are tilebale. Let's say there is a srcBitmap from where I copy a region given by a Rectangle srcRegion. I then want to paste (pixel information wise) that region into another image called Bitmap destBitmap, in a destination region Rectangle destRegion. I know how to get the region from the source and put it into a Bitmap object, but I haven't yet been able to find how to actually paste a Bitmap object in a

Silverlight 4 BitmapImage - bmp file support

旧城冷巷雨未停 提交于 2019-12-20 07:22:41
问题 MSDN mentions support for PNG and JPG, but many people are trying setSource(file.bmp) and complaining about "Catastrophic failures". Can someone clarify this, is bmp supported or not ? And if not, what is the best way for displaying a bmp in silverlight ? 回答1: BMP is not supported in Silverlight. BMP is a very old and not a very efficient format (compared with PNG & JPG) so they have not bothered to support it. Silverlight only supports JPG & PNG format images. The best way to display them is

Handling image load exception gracefully

混江龙づ霸主 提交于 2019-12-20 06:45:23
问题 I'm loading user images using Silverlight 3. Everything works fine and I can set the file stream to a BitmapImage and it gets rendered OK. The problem is that if I try to load something that's not an image (like a .exe that's been renamed to .png) Silverlight crashes with a System.Exception that says "Catastrophic failure". The MSDN documentation unhelpfully says that it should be so there msdn link and I should listen to the ImageFailed event (which never gets fired). Am I missing something

Convert a dynamic BitmapImage to a grayscale BitmapImage in a Windows Phone application

六月ゝ 毕业季﹏ 提交于 2019-12-20 04:32:43
问题 I would like to Convert a BitmapImage to a Grayscale BitmapImage: Which I get from a method and therefore - the Width and Height are unknown to me. I have tried looking into options such as WritableBitmapEx and static extension methods but they haven't been helpful to me as I would like the return data type to be a BitmapImage as well as I then need to add it to List. Is this possible in a Windows Phone app using C#? I would really appreciate if someone would shed some light into this. Thank

UWP BitmapImage SetSource from MemoryStream hangs

六眼飞鱼酱① 提交于 2019-12-20 02:44:18
问题 In my UWP app i store images in an SQLite db in form of byte[]. Then as i retrieve my objects from the db i bind them to a GridView data template which has an Image control. As i cant bind the Image's Source directly to the array, so i have created a BitmapImage property in my object's class to bind the Image control to: public BitmapImage Icon { get { using (var stream = new MemoryStream(icon)) { stream.Seek(0, SeekOrigin.Begin); var img = new BitmapImage(); img.SetSource(stream

Rotate a BitmapImage

≡放荡痞女 提交于 2019-12-19 10:02:06
问题 I want to rotate a bitmap image I wrote some code and it work TransformedBitmap TempImage = new TransformedBitmap(); TempImage.BeginInit(); TempImage.Source = MyImageSource; // MyImageSource of type BitmapImage RotateTransform transform = new RotateTransform(90); TempImage.Transform = transform; TempImage.EndInit(); image1.Source = TempImage; but I want that MyImageSource get this modification, because like that if I click again in the button nothing happen and this normal it get the first