Questions tagged [bitmapsource]

Bitmapsource represents a single, constant set of pixels at a certain size and resolution.

What questions should have this tag:
.Net Framework questions utilizing the BitmapSource class under the System.Windows.Media.Imaging namespace.

Basic Definitions:
Maximum height and width of an image: 2^16 pixels at 32 bits per channel * 4 channels
Maximum size of a BitmapSource: 2^32 bytes (64 gigabytes)
Maximum image size: 4 (four) gigapixels
Minimum image size: 1x1

Brief Introduction:
Part of the Windows Presentation Foundation (WPF) imaging pipeline, BitmapSource represents a single, constant set of pixels at a certain size and resolution. Multi-frame images and animations are not represented by BitmapSource.

Important Links:
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapsource.aspx

136 questions
3
votes
2 answers

Async databinding of image, causes cross thread exception

I have a problem, with my WPF application. I'm trying to databind an image field, in my gridview, with the image property from my viewmodel.
Nicolai
  • 2,835
  • 7
  • 42
  • 52
3
votes
0 answers

BitmapSource MemoryStream leak with large images

I'm working with image files over 1 GB, creating a Bitmap from a large BitmapSource and attempting to dispose of the original BitmapSource. The BitmapSource stays in memory. Normally this is an inconvenience as it is eventually collected, but with…
BCCode
  • 94
  • 1
  • 6
2
votes
0 answers

Kinect and EMGU (OpenCV) - BitmapSource issue

Alright, so basically I am trying to use openCV with the Kinect (Microsoft's new Kinect 1.0 SDK). I am very new to both C# and Kinect. But what I want to do is use the kinect for facial recognition using EMGU (openCV wrapper for C#). So far I…
2
votes
1 answer

Unable to retrieve TIFF pages from TiffBitmapDecoder.Frames -- all frames are page 1

I'm trying to convert a multipage tiff image into a multipage XPS document. The problem I'm having is with the TiffBitmapDecoder and its BitmapFrames. Here's the code: private static void ToXpsDocument(string imageName, string xpsName) { using…
user1228
2
votes
1 answer

WPF - Convert file to Byte[] to BitmapSource using JpegBitmapDecoder

I need to read a jpg file and latyer display it in an Image controll. The following works perfectly: imgTwo.Source = FetchImage(@"C:\Image075.jpg"); public BitmapSource FetchImage(string URLlink) { JpegBitmapDecoder decoder = null; …
Keren
  • 81
  • 2
  • 10
2
votes
1 answer

Get System.Drawing.Bitmap of a WPF Area using VisualBrush

The point is, that I need to convert to a System.Drawing.Bitmap (.Net Framework 2.0) to get a single frame of an WPF Grid with its content. I read about VisualBrush and DrawingBrush but I cannot imagine how it should work. I can convert any WPF…
Nasenbaer
  • 4,810
  • 11
  • 53
  • 86
2
votes
2 answers

using BitmapSource as Image source in WPF

I'm trying to update an Image (_browserScreenshot below) object in XAML by changing the source image every time an event determines the source needs updating. Right now I have this: public BitmapSource GetScreen() { Bitmap bitmap = new…
Beaker
  • 2,804
  • 5
  • 33
  • 54
2
votes
2 answers

BitmapSource.CopyPixel: how to copy only area of interest?

I have a System.Windows.Media.Imaging.BitmapSource, and a small Int32Rect. I want to copy only the bytes of the bitmap that are in the rectangle to a buffer. Addition: I want to use this buffer to do calculations with the pixel values, in this case:…
Harald Coppoolse
  • 28,834
  • 7
  • 67
  • 116
2
votes
1 answer

PngBitmapDecoder stream question

Don't know a whole lot about streams. Why does the first version work using a file but the second does not? Putting a breakpoint on "return dest;" it looks like both have created exactly the same thing but dest is always a blank image using the…
strattonn
  • 1,790
  • 2
  • 22
  • 41
2
votes
1 answer

WPF Rotate and return BitmapSource by any angle

Hei, I tried this: public static BitmapSource RotateImage(Image b, float angle) { BitmapSource rotita = (BitmapSource)b.Source; DrawingVisual drawingVisual = new DrawingVisual(); using (DrawingContext drawingContext =…
Alex
  • 23
  • 3
2
votes
0 answers

BitmapSource rendering glitch due to large width, probable overflow

I've got a bitmap that's 827852 pixels wide by 1 pixel high in a Bitmap object. When converting the bitmap to a BitmapSource for rendering in WPF, the following artifacts appear in the UI: The black portion in the middle is not in the original…
Nattfrosten
  • 1,999
  • 4
  • 16
  • 21
2
votes
1 answer

Using resources images in WPF

From what I've seen, WPF images' source is a BitmapSource object while the Resources images are read as bitmap. I've easily found a way to convert images from Bitmap format into BitmapSource format but I believe that running this conversion every…
sagibb
  • 956
  • 2
  • 9
  • 21
2
votes
2 answers

Blue and red channels swapped during conversion from bitmap to bitmapsource

I need to copy a bitmap that I receive from a camera into a BitmapSource in order to show it in a WPF application. Image arrives in PixelFormat.Format24bppRgb with a negative stride. I got this working by following code //NOTE: image is in…
Rok
  • 705
  • 8
  • 20
2
votes
1 answer

How to share pixel data between Bitmap and Bitmapsource without a reallocation?

Is it possible to create a System.Windows.Media.Imaging.Bitmapsource from a System.Drawing.Bitmap without a reallocation? Unfortunately all methods described in other post included a copy of the pixel data which is not always needed and very…
smedasn
  • 1,249
  • 1
  • 13
  • 16
2
votes
0 answers

Copy BitmapSource into clipboard

I'm trying to do a client-server program in which it is possible to share the content of the clipboard. I got a problem when the clipboard contains an Image. I'm able to encode the BitmapSource to a Byte Array, send it and then decode and inject it…
1 2
3
9 10