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
0
votes
1 answer

Out of memory when using BitmapSource

I'm changing source of a WPF image on run time with a frequency of 30ms ( 30 fps ). I'm getting an OutOfMemory. In the following code, iImage is a private object displayed and owned by the wpf application. bytes is a byte array readed and stored…
BuzBuza
  • 607
  • 2
  • 7
  • 19
0
votes
1 answer

Is it possible to create a TIFF image in NET 6?

I'm looking for a way of creating a multi-page TIFF image in NET 6 (console app). I still have an option to switch back to NET 4.8, but I would try to avoid it. Is there any way to use BitmapSource, TiffBitmapEncoder, etc from the NET 6 console app?
0
votes
1 answer

BitmapSource vs DrawingImage

I know DrawingImage has a Drawing property to which we can set any of the Drawing sub-classes which represent a geometry with a brush and a pen. But where does BitmapSource store its pixels, in the MSDN documentation the description for BitmapSouce…
mihajlv
  • 2,275
  • 4
  • 36
  • 59
0
votes
1 answer

ImageSource Class on MSDN Mistake?

I am unclear of what this means from the definition on ImageSource class on MSDN: Represents a object type that has a width, height, and ImageMetadata such as a BitmapSource and a DrawingImage. This is an abstract class, DrawingImage and…
mihajlv
  • 2,275
  • 4
  • 36
  • 59
0
votes
1 answer

How do I convert from mouse coordinates to pixel coordinates of a TransformedBitmap embedded in a larger parent container?

Similar to How do I convert from mouse coordinates to pixel coordinates of a TransformedBitmap? but with the added wrinkle that my Image is actually embedded in a larger parent Grid, which has a background, and I would like the pixel coordinates to…
Craig W
  • 4,390
  • 5
  • 33
  • 51
0
votes
1 answer

How do I convert from mouse coordinates to pixel coordinates of a TransformedBitmap?

My question is similar to How to get correct position of pixel from mouse coordinates?, with the added caveat that the image is potentially a TransformedBitmap, where flips and rotations could be applied, and still return the pixel coordinates of…
Craig W
  • 4,390
  • 5
  • 33
  • 51
0
votes
1 answer

Memory 'leak' with MemoryStream and BitmapCacheOption.OnLoad

I have to get a BitmapSource from an Image and for this I use an extension method like this: public static BitmapSource ToBitmapSource(this Image image) { LogEx.FunctionEnter(); if (image == null) throw new…
Marcel Grüger
  • 885
  • 1
  • 9
  • 25
0
votes
1 answer

Can a pixel also store information regarding strokes drawn on that part of the image?

I was learning about bitmaps and canvas and was curious about one thing . Does a pixel only store color information related to an image or also the strokes involved within a drawing .For example , if I just draw a circle on a canvas . Now , will the…
0
votes
1 answer

How to output an image of a WPF control to the clipboard

I have the following code that takes a Control (as a Visual object), uses a Visual Brush to pain the control into a RenderTargetBitmap which can then be saved to disk. This is successful. I would like to use the same code to place the image in the…
drG_Bristol
  • 165
  • 9
0
votes
1 answer

.NET/C#/Xaml display video from bytes or Bitmap

I use a IP camera and its library to get the image from the camera. The library allows me to get the byte array or a bitmap. I wish to display the video in my Xaml window. I need something fast and I do not know how to do it. Currently I use a Image…
0
votes
1 answer

How to convert byte[] to BitmapSource in c# WPF

I have a byte buffer (byte[]) of an image. I have to convert byte[] to BitmapSource (System.Windows.Media.Imaging.BitmapSource). private void WriteAsJpeg(string fileName, BitmapSource bmp) { JpegBitmapEncoder encoder =…
0
votes
1 answer

ArgumentException not caught when using BitmapImage.BeginInit()

Why when an ArgumentException occurs because image.jpg has an invalid metadata header does the first example catch the exception, and the second example does not? Example 1: try { Uri myUri = new Uri("http://example.com/image.jpg",…
radicalpi
  • 907
  • 1
  • 9
  • 29
0
votes
1 answer

How can I zoom in on a certain region of a BitmapSource in a WPF Image control?

Let's say I have a 1280x1024 BitmapSource in a WPF Image control. There is a 100x100 "active" area of this image that I want to be able to zoom in on with a button click. I want to zoom as much as possible while maintaining the aspect ratio and…
Craig W
  • 4,390
  • 5
  • 33
  • 51
0
votes
1 answer

BitmapSource equivalent in C++?

I have a working code written in C#, which takes an array of byte, representing a bitmap image, and encode it in base64, so it can be shown with a browser. byte[] bitmap = {...} //getting it from c++ .dll BitmapSource bs = BitmapSource.Create(w, h,…
Autruche
  • 67
  • 1
  • 6
0
votes
0 answers

BitmapSource copypixels method does not return rgb pixels data

I'm readying pixel data from a PNG BitmapSource using CopyPixels method. However the read call into array does not return the pixel data. Any reason why this would happen ? I have included the image below Edit: Byte array doesn't contain the RGB…
Kartik150
  • 555
  • 1
  • 5
  • 19