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

How to draw a line on an existing BitmapSource in WPF?

I would like to draw a line (or any geometric shape) on an existing BitmapSource object in my WPF application. What is the best way to do it ? The BitmapSource is the result of a BitmapSource.Create(...) call. Thanks Romain
HW2015
  • 81
  • 2
  • 11
0
votes
1 answer

How to construct indexed8 bitmap from pixeldata and palette

I am trying to create a 3x1 bitmap with a specified palette. For testing I used 3 colors: red, green and blue. When I run my code all I get is all red (which is the first color). This is my code public void CreateTestImg() { // List to store…
TizzyT455
  • 3
  • 3
0
votes
2 answers

error of creating bitmap from Bitmapsource.create from C# Visual Studio 2013 WPF

I am trying to build a bitmap for a map tile by the following function from C# Visual Studio 2013 WPF. https://msdn.microsoft.com/en-us/library/ms616045%28v=vs.110%29.aspx public static BitmapSource Create(int pixelWidth, int pixelHeight, double…
user3448011
  • 1,469
  • 1
  • 17
  • 39
0
votes
3 answers

WPF: How to rotate a BitmapSource by any angle

Ok, I tried this: TransformedBitmap tbm = new TransformedBitmap(myBitmapSource, new RotateTransform(angle)); return tbm; But this does not work with angles other than multiples of 90degrees. New I tried to use a RenderTargetBitmap: var image =…
juFo
  • 17,849
  • 10
  • 105
  • 142
0
votes
1 answer

BitmapSource.Create issue

I have a question about BitmapSource.Create. I have the following code, and it's not behaving as expected: reader.BaseStream.Position += BytesInMetadata; var rawData = new UInt16[NumberOfPixels]; // Read in the raw image data in 16 bit…
Ian Cyr
  • 23
  • 5
0
votes
1 answer

Alternative to BitmapSource.Create in Windows Store application (UWP)

I have an Application written mostly in a PCL. When consuming this in an WPF Application I have a platformspecific codeblock that looks like this: BitmapSource bitmapSource = BitmapSource.Create(generic.Width, generic.Height, 300, 300,…
0
votes
1 answer

"URI formats are not supported" when converting Bitmap image (Kinect v2) to Emgu Image

I am working on an project where I want to use Kinect camera 2 (SDK v2), with Emgu library (2.4.10.1940). First I converted the Kinect ColorFrame to BitmapSource and then from BitmapSource to Drawing.Bitmap. When I try to convert from Drawing.Bitmap…
k_fyraj
  • 33
  • 1
  • 7
0
votes
1 answer

Canvas InvalidateVisual() thread exception

I'm developing an app that shows some images (with some filter effects) using Canvas. I've a static class called RendererBooster. This class' RenderImage() method renders the image with given effects WITH TASK on background and sets the MyViewer…
cKNet
  • 635
  • 1
  • 10
  • 22
0
votes
1 answer

Saving an image using FileStream sometimes results in corrupt files

I have an application where by I take a picture and press a save button and save the image to the computer. This works fine the majority of the time. But I am seeing some of my users with corrupt images. These images are about the right number of…
JKennedy
  • 18,150
  • 17
  • 114
  • 198
0
votes
1 answer

WPF: Converting a BitmapImage to an array and edit it, then recreating it

I want to develop a Steganography software in WPF, so I need direct access to pixels, I am trying to convert a Bitmap to an array and edit it, the problem is I can only recreate it by BitmapSource (am I right?) and I can't recreate it correctly. I…
0
votes
0 answers

c++-cli CreateBitmapSourceFromMemorySection

I am trying to create Bitmap^ from unsigned char* databuffer. I need to do this very effective - this function called many times each second and GUI updated after it runs. My code is : unsigned char* databuffer = new unsigned…
Matvey
  • 163
  • 2
  • 10
0
votes
1 answer

Print several BitmapSources with different page orientations

In C#, I have a collection of BitmapSource that are in the same document. These BitmapSources have independent page orientation each, and I want to print them, keeping the page orientation set for each page, in the same print job. Today, I'm unable…
0
votes
0 answers

When should call GC.Collect()?

I'm using BitmapSource to draw frames as video that get from IP Camera. The below is summary code. while(true) { char* rgbBuffer = GetFrameFromCamera(); BitmapSource^ bitmapSource = BitmapSource::Create(resX, resY, 96, 96,…
TTGroup
  • 3,575
  • 10
  • 47
  • 79
0
votes
1 answer

WPF: Drawing Bitmap - Access Violation?

My program is drawing the Bitmap Frames to WPF control as video. The sample code is below: while(true) { mStream = gcnew UnmanagedMemoryStream((unsigned char*)jpegBuff, jpegBuffLenght); JpegBitmapDecoder^ decoder = gcnew…
TTGroup
  • 3,575
  • 10
  • 47
  • 79
0
votes
2 answers

Is it possible to convert a byte[] to a bitmapsource?

So far I have: using (MemoryStream ms = new MemoryStream(imageData)) { Bitmap img = (Bitmap)Image.FromStream(ms); } And then I would imagine I would be able to get a BitmapSource from img somehow? If this is totally wrong please feel free to…
JKennedy
  • 18,150
  • 17
  • 114
  • 198