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

How to save an image to the clipboard only knowing the images path

Say if I have an image path C:\MyImages\MyImage.jpg how would I get this onto the clipboard using C#. I know I would use the class System.Windows.Clipboard.SetImage(); but this takes a BitmapSource as the parameter. How would I get a BitmapSource…
JKennedy
  • 18,150
  • 17
  • 114
  • 198
2
votes
2 answers

Convert WPF BitmapSource to Icon for window

I have a 16x16 .png file which I have loaded as an ImageSource (BitmapSource) and it is working fine when I use it on an Image in a tabcontrol header. I now want to use that same image in a floating window (inherited from the WPF Window class) when…
simmotech
  • 61
  • 1
  • 4
2
votes
1 answer

How to copy the image data from a BitmapSource (WPF) to a cv::Mat (OpenCV) in C++/CLI in a different thread?

I have a BitmapSource created in the UI thread and I would like to copy its pixel data to a cv::Mat for processing on a separate thread. Of course it works if I wrap the copy code with Dispatcher.Invoke call but then I waste synchronization…
Darien Pardinas
  • 5,910
  • 1
  • 41
  • 48
2
votes
1 answer

How to feed a custom ImageSource to Image in XAML

One way to set an ImageSource for Image in XAML is like this: This code…
2
votes
2 answers

Is BitmapSource the only type can be used in Image Source?

We can use Bitmapsource object as the content of a Image control, However if I only have Bitmap object, can I use it directly, if I convert Bitmap to Bitmapsouce using the following method: Bitmap bitmap = imageObjToBeConvert; IntPtr…
user25749
  • 4,825
  • 14
  • 61
  • 83
2
votes
1 answer

Remove alpha from a BitmapSource

I use BitBlt() and CreateBitmapSourceFromHBitmap() to capture a window as a BitmapSource that I can display on an Image element in a WPF application. But for some reason, most of the application that it captures is transparent. Here is a source vs.…
directedition
  • 11,145
  • 18
  • 58
  • 79
2
votes
1 answer

Append Image to Clipboard

I have third part control Chart which has CopyToClipboard(size) functionality. Same method returns BitMapSource as well. So my need is: Append another BitMapSource to clipboard. How to acheive this functionality?. Similarity between these two image…
Mohanavel
  • 1,763
  • 3
  • 22
  • 44
2
votes
1 answer

Saving BitmapSource as Tiff encoded JPEG using Libtiff.net

I'm trying to write a routine that will save a WPF BitmapSource as a JPEG encoded TIFF using LibTiff.net. Using the examples provided with LibTiff I came up with the following: private void SaveJpegTiff(BitmapSource source, string filename) { …
making
  • 408
  • 6
  • 21
1
vote
1 answer

Converting a BitmapSource to Image keeping all frames

I have a method here that is supposed to produce a System.Drawing.Image instance. Consider the following prerequesites: I get a BitmapSource as a method parameter Below you find the code that does the transformation from BitmapSource to…
Sebastian Edelmeier
  • 4,095
  • 3
  • 39
  • 60
1
vote
1 answer

C# Converting BitmapSource to BitmapImage

I am trying to write a function that converts a BitmapSource to a BitmapImage. The only way I could find to do this was to create a temporary bmp file write and read from the file to create a new BitmapImage. This works fine until you try to delete…
Sari Rahal
  • 1,897
  • 2
  • 32
  • 53
1
vote
1 answer

Convert Bitmap to BitmapSource

I have problem with converting bitmap to bitmapsource, I write something like this http://www.codeproject.com/KB/WPF/BitmapToBitmapSource.aspx?msg=3590727 , but I get exceptions: A first chance exception of type 'System.InvalidOperationException'…
1
vote
1 answer

Exception: BitmapFrameDecode must have IsFrozen set to false to modify

I have a program written in C# WPF to print documents automatically. One of the features it has is it can detect image download failure so the document which has that empty image doesn't get printed. This is one part of the code to detect download…
Rizki Pratama
  • 551
  • 4
  • 23
1
vote
3 answers

BitmapImage from Stream returns 1x1px instead of the whole image

I have a method that opens a FileStream and creates a BitmapImage, by using the StreamSource property. Somehow, in a single machine, trying to open a big image (6000x4000px) results in the method returning a 1x1px image instead. First I thought that…
Nicke Manarin
  • 3,026
  • 4
  • 37
  • 79
1
vote
1 answer

Error when saving BitmapSource

I have a problem when I try to save a BitmapSource. I alsways get an error in GDI+ or that the file is in use by another proces. The methode to save the bitmapimage protected override void Save() { Bitmap bitmap = Thumbnail.ToBitmap(); if…
Wim
  • 378
  • 2
  • 6
  • 14
1
vote
1 answer

Save WPF BitmapSources as h264 encoded video directly from Memory

Currently I am utilizing a List-variable to store BitmapSources provided by a camera and save them as an AVI file with the help of SharpAvi. In a second step I then encode the saved file via Nrecos ffmpeg wrapper to decrease file size. Finally I…
Daniel M
  • 105
  • 2
  • 11