writeablebitmap

How can I merge 2 images on Windows Phone

大憨熊 提交于 2019-12-06 03:02:32
问题 I have 2 images and I want to merge them into one on my apps in Windows Phone. The first image captured by my WP's camera, the second image is a frame (borders, filter, etc.) which user can choose among our templates. So how can I merge them into one. Thanks and best regards. 回答1: I don't quite understand what you ask. But I guess you want to overlay 1 image on top of another. If so, there is already an answer here. Inside the <grid> , you can provide both the image, and customize the opacity

How to dispose a Writeable Bitmap? (WPF)

独自空忆成欢 提交于 2019-12-05 05:12:21
Some time ago i posted a question related to a WriteableBitmap memory leak, and though I received wonderful tips related to the problem, I still think there is a serious bug / (mistake made by me) / (Confusion) / (some other thing) here. So, here is my problem again: Suppose we have a WPF application with an Image and a button. The image's source is a really big bitmap (3600 * 4800 px), when it's shown at runtime the applicaton consumes ~90 MB. Now suppose i wish to instantiate a WriteableBitmap from the source of the image (the really big Image), when this happens the applications consumes

Why is my unsafe code block slower than my safe code?

六眼飞鱼酱① 提交于 2019-12-05 04:17:25
I am attempting to write some code that will expediently process video frames. I am receiving the frames as a System.Windows.Media.Imaging.WriteableBitmap . For testing purposes, I am just applying a simple threshold filter that will process a BGRA format image and assign each pixel to either be black or white based on the average of the BGR pixels. Here is my "Safe" version: public static void ApplyFilter(WriteableBitmap Bitmap, byte Threshold) { // Let's just make this work for this format if (Bitmap.Format != PixelFormats.Bgr24 && Bitmap.Format != PixelFormats.Bgr32) { return; } //

Why do my images sometimes reload (and WriteableBitmaps disappear) on resume?

房东的猫 提交于 2019-12-05 01:05:41
问题 When I resume my app, sometimes it loses its images. I can reproduce this even in trivial apps. This manifests in two different ways, depending on where the image came from: If I did something like <Image Source="/Assets/Logo.png"/> (i.e., loading an image from my app package by URI), the image will disappear briefly, and then reload. This is easier to see when the screen contains many images; they reload in sequence, so I can watch the image loading ripple across the screen. If I created a

WinRT: how to save WriteableBitmap to localfolder

丶灬走出姿态 提交于 2019-12-04 17:39:07
How to save a WriteableBitmap to localfolder using C# in WinRT? You can check WinRT XAML Toolkit for a set of extension methods to do exactly what you need: http://winrtxamltoolkit.codeplex.com/SourceControl/changeset/view/0657c67a93d5#WinRTXamlToolkit%2fImaging%2fWriteableBitmapSaveExtensions.cs Mayank Here are bits and pieces of the answer var bitmap = new WriteableBitmap(width,height); var stream = bitmap.PixelBuffer.AsStream(); than you can get IOutputStream from Stream to write the data into the local folder. this post explains how to convert Stream to byte[] and this explains how to

Resizing WritableBitmap

a 夏天 提交于 2019-12-04 15:47:02
I have created a WriteableBitmap in Gray16 format. I want to resize this WriteableBitmap to my known dimention preserving the pixel format(Gray16). Is any one worked on the Resizing the WriteableBitmap. Please help me. I also searched the internet and found http://writeablebitmapex.codeplex.com/ but this through an assebmly reference error. Please help me. You can use the following function to resize a writableBitmap : WriteableBitmap resize_image(WriteableBitmap img, double scale) { BitmapSource source = img; var s = new ScaleTransform(scale, scale); var res = new TransformedBitmap(img, s);

How can I merge 2 images on Windows Phone

一笑奈何 提交于 2019-12-04 07:58:23
I have 2 images and I want to merge them into one on my apps in Windows Phone. The first image captured by my WP's camera, the second image is a frame (borders, filter, etc.) which user can choose among our templates. So how can I merge them into one. Thanks and best regards. Agung Pratama I don't quite understand what you ask. But I guess you want to overlay 1 image on top of another. If so, there is already an answer here . Inside the <grid> , you can provide both the image, and customize the opacity of each image to make it overlay-ed. EDITED: You can use Writeablebitmap for that and there

Why do my images sometimes reload (and WriteableBitmaps disappear) on resume?

拜拜、爱过 提交于 2019-12-03 16:30:57
When I resume my app, sometimes it loses its images. I can reproduce this even in trivial apps. This manifests in two different ways, depending on where the image came from: If I did something like <Image Source="/Assets/Logo.png"/> (i.e., loading an image from my app package by URI), the image will disappear briefly, and then reload. This is easier to see when the screen contains many images; they reload in sequence, so I can watch the image loading ripple across the screen. If I created a WriteableBitmap and bound it to Image.Source, then the bitmap disappears entirely, never to return. I

How to Reduce Size of Image in windows phone

冷暖自知 提交于 2019-12-02 11:12:41
问题 I am trying to port my app in windows phone . i have to upload an image on server So it is in small Size For uploading i have done this thing in Widows Successfully but problem is when i failed in it .. here is my code for windows App public void CompressImage(int i, int j) { bmp1.SetPixel(j, i, Color.FromArgb(bmp.GetPixel(j, i).R, bmp.GetPixel(j, i).G, bmp.GetPixel(j, i).B)); } private void bLoadImage_Click(object sender, EventArgs e) { OpenFileDialog file = new OpenFileDialog(); if (file

Handling image load exception gracefully

我是研究僧i 提交于 2019-12-02 09:19:41
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 there or is the library broken when loading from a stream? The code I've got loading the image from the