writeablebitmap

How to Reduce Size of Image in windows phone

只谈情不闲聊 提交于 2019-12-02 02:53:29
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.ShowDialog() == DialogResult.OK) { pictureBox1.Image = new Bitmap(file.FileName); } } private void

Load BitmapImage into WriteableBitmap but no method existing

混江龙づ霸主 提交于 2019-12-01 13:42:55
The constructor of WriteableBitmap class with Windows 8 only takes two arguments: the height and the width of this object. Meanwhile with Silverlight it accepts a BitmapImage object as argument. (Verified on MSDN : WriteableBitmap.WriteableBitmap constructor ) I would like to load this BitmapImage because I'm trying to blur an image which already exists on my Assets folder. Thanks for your help, I succeed to blur my image. Here is the sample in order to link the BitmapImage into the WriteableBitmap object : BitmapImage bi = new BitmapImage(new Uri(filename, UriKind.RelativeOrAbsolute));

Asynchronous operations on WriteableBitmap

痴心易碎 提交于 2019-12-01 08:41:22
I'm writing an application in WPF (C#) which does long operations on a collection of Bitmaps. To keep my application responsive, I decided to use another thread to perform the operations on bitmaps and report progress on a progressbar in main UI thread. I thought BackgroundWorker would do anything for me, but looks like it won't be that easy. I have the following code: public class ImageProcessor { public Collection<WriteableBitmap> Pictures { get; private set; } private BackgroundWorker _worker = new BackgroundWorker(); public ImageProcessor() { _worker.DoWork += DoWork; } public void

Drawing line using WPF WriteableBitmap.BackBuffer

我与影子孤独终老i 提交于 2019-12-01 08:16:27
Do you know any library that provides methods to draw simple shapes (lines and optionally other shapes) using WPF WriteableBitmap and ideally BackBuffer? I know that there is a WriteableBitmapEx project for silverlight but is there WPF equivalent? adrin I guess here is the answer to my question :) _plotBitmap.Lock(); var b = new Bitmap(_plotBitmap.PixelWidth, _plotBitmap.PixelHeight, _plotBitmap.BackBufferStride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, _plotBitmap.BackBuffer); using(var bitmapGraphics = System.Drawing.Graphics.FromImage(b)) { bitmapGraphics.SmoothingMode =

In WinRT, how do I load an image and then wait only as long as is needed for it to load before writing to it?

我与影子孤独终老i 提交于 2019-12-01 07:57:59
问题 I'm using WriteableBitmapEx in a WinRT project. I load an image into a WriteableBitmap from the users Picture library. However, I cannot then immediately write to that image, if I do, it will be overwritten with the image itself (it seems like it's Async loading the image and then it's overwritting my drawing on top of it). I don't know how to stop it from doing that (I tried using Await on the SetSource but that's not an Async method). I've used an "Await Task.Delay(1000)" and that works,

Pixel by Pixel Color Conversion WriteableBitmap => PNG Black only to Color with Transparency

廉价感情. 提交于 2019-12-01 06:46:58
I am working on a silverlight application, where all my icons are PNGs. The color of all these icons is black, or rather black to gray, depending on the alpha value. Every PNG has a transparent background. Inside my application, I want to do a pixel by pixel color change from black or gray, let's say to red (before black) or light red (before gray). Walking through the bytes of every pixel, I recognized, that every full black pixel has an alpha value of 255. Those, who are gray, have an an alpha value between 1 and 254. An alpha value of 0 seem to be transparent. The RGB values are all 0 for

Pixel by Pixel Color Conversion WriteableBitmap => PNG Black only to Color with Transparency

核能气质少年 提交于 2019-12-01 04:20:43
问题 I am working on a silverlight application, where all my icons are PNGs. The color of all these icons is black, or rather black to gray, depending on the alpha value. Every PNG has a transparent background. Inside my application, I want to do a pixel by pixel color change from black or gray, let's say to red (before black) or light red (before gray). Walking through the bytes of every pixel, I recognized, that every full black pixel has an alpha value of 255. Those, who are gray, have an an

Using FJCore to encode Silverlight WriteableBitmap

≡放荡痞女 提交于 2019-11-30 21:49:06
I am trying to find out how to use FJCore to encode a WriteableBitmap to a jpeg. I understand that WriteableBitmap provides the raw pixels but I am not sure how to convert it to the format that FJCore expects for its JpegEncoder method. JpegEncoder has two overloads, one takes a FluxJpeg.Core.Image and the other takes in a DecodedJpeg. I was trying to create a FluxJpeg.Core.Image but it expects a byte[][,] for the image data. byte[n][x,y] where x is width and y is height but I don't know what n should be. I thought that n should be 4 since that would correspond to the argb info encoded in each

Using FJCore to encode Silverlight WriteableBitmap

随声附和 提交于 2019-11-30 05:31:22
问题 I am trying to find out how to use FJCore to encode a WriteableBitmap to a jpeg. I understand that WriteableBitmap provides the raw pixels but I am not sure how to convert it to the format that FJCore expects for its JpegEncoder method. JpegEncoder has two overloads, one takes a FluxJpeg.Core.Image and the other takes in a DecodedJpeg. I was trying to create a FluxJpeg.Core.Image but it expects a byte[][,] for the image data. byte[n][x,y] where x is width and y is height but I don't know what

Save WriteableBitmap to file using WPF

自作多情 提交于 2019-11-29 09:25:14
I have: WriteableBitmap bmp; I basicly want to save it into a file on the disk like the following: C:\bmp.png I read some forums which mentions to read: bmp.Pixels and save those pixels into a Bitmap then use Bitmap.SaveImage() function. However, I can't access any Pixels . Apperantly my WriteableBitmap does not have any property named Pixels . I use .NET Framework 4.0. Use your WriteableBitmap's clone and use this function as below: CreateThumbnail(filename, _frontBitmap.Clone()); ... void CreateThumbnail(string filename, BitmapSource image5) { if (filename != string.Empty) { using