Questions tagged [bitmapencoder]

18 questions
6
votes
1 answer

UWP encode image to PNG

I get an image by URI (web or file system) and want to encode it into PNG and save to a temporary file: var bin = new MemoryStream(raw).AsRandomAccessStream(); //raw is byte[] var dec = await BitmapDecoder.CreateAsync(bin); var pix = (await…
Mike Tsayper
  • 1,686
  • 1
  • 17
  • 25
4
votes
1 answer

BitmapEncoder Save Not Supported

I have the following code and I can't see anything wrong, any ideas on what the problem could be? private static string SaveBaseImage( ZipArchive arc, DBImage image, int imageIndex ) { using (var mem = new MemoryStream(image.Data)) { …
MikeT
  • 5,398
  • 3
  • 27
  • 43
3
votes
1 answer

BitmapEncoder flush throws Argument Exception

I'm trying to resize images in my UWP application. Most of the time the appended code works, but sometimes await encoder.FlushAsync(); throws an ArgumentException. I've headed over to MSDN…
Florian Moser
  • 2,583
  • 1
  • 30
  • 40
2
votes
1 answer

JPEGEncoder Windows Media Imaging not honoring color profile of Image

I have the following image (have put a screen-grab of the image as its size is more than 2 MB - the original can be downloaded from https://drive.google.com/file/d/1rC2QQBzMhZ8AG5Lp5PyrpkOxwlyP9QaE/view?usp=sharing I'm reading the image using the…
techno
  • 6,100
  • 16
  • 86
  • 192
2
votes
3 answers

TiffBitmapEncoder, memory bug causing Insufficient Memory Exception in C#/WPF

I have a WPF application where I am saving couple of hundreds of BitmapSources by converting them to TIFF images using TiffBitmapEncoder. However, I have this strange memory consumption which is often throwing Insufficient Memory Exception. NOTE:…
Miro Bucko
  • 1,123
  • 1
  • 13
  • 26
1
vote
0 answers

C# image /xmp/projectionType setquery error : (add image meta data /xmp/projectionType)

My goal is set value to "/xmp/projectionType" meta data for jpeg image. I can set "text/descryption" by following code but error throwing when I try to set value for "/xmp/ProjectionType" using (FileStream fs = new…
Subramani
  • 347
  • 3
  • 11
1
vote
0 answers

BitmapFrame.Create cannot access this object

I'm trying to export several BitmapSource images from to png files. Here's my code: Thread Call: var exportImagesThread = new Thread(ExportRangeOfImages); exportImagesThread.Start(); Function: private void ExportRangeOfImages() { for (var…
Idanis
  • 1,918
  • 6
  • 38
  • 69
1
vote
0 answers

Index was out of range.

I am now want to capture a Bitmap by using the BitmapEncoder/BitmapDecoder. Below is the saveImageAsync codes private async void SaveBitmapAsync() { List _pixelData = null; //convert the source bitmap to a pixel array …
Yajun
  • 11
  • 3
1
vote
2 answers

TiffBitmapEncoder: Making bitmap encoding asynchronous

Problem: how can I save/compress bitmap images (several of them stacked in tiff file) asynchronously with respect to the main thread? My setting: (synchronous & slow working solution: when the compression is performed the thread remains stuck for a…
Acorbe
  • 8,367
  • 5
  • 37
  • 66
0
votes
0 answers

Unable to capture WPF livechart in bitmap

I'm trying to write a function that will write the results of a test (which have both text output and chart output, stored in a textbox and a livecharts chart respectively) to a pdf file. There are no issues with the text output, but I haven't been…
John Snow
  • 9
  • 1
0
votes
1 answer

Cannot create more Dispatcher. Runs out of resource?

In our application, we are using PngBitmapEncoder to encode and save PNG image in a separate thread\task. After few days of running the application we are seeing Dispatcher cannot be created from Encoder and throws error Not enough storage is…
Rahul Sundar
  • 480
  • 8
  • 26
0
votes
0 answers

How detect that BitmapEncoder save method is finished

There is i have : public void SaveBitmapSourceToFile(string filePath, BitmapSource img) { BitmapEncoder encoder = new JpegBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(img)); using (FileStream fileStream = new…
Sintex
  • 9
  • 1
0
votes
1 answer

BitmapEncoder FlushAsync throws Argument Exception - c#

When I'm using below code for image processing it throws exception at FlushAsync(). Strangely this issue happens for some video files only. Can you help why this happen ? private async Task PreProcessVideoToGetTextAsync(StorageFile file,…
nsds
  • 961
  • 4
  • 13
  • 39
0
votes
1 answer

BitmapImage to Bitmap throw exception

i use for a project a function that i found on StackOverflow : https://stackoverflow.com/a/6484754/9535211 The goal of this function is to convert a System.Windows.Media.Imaging.BitmapImage to a System.Drawing.Bitmap. public Bitmap…
Axel.A
  • 94
  • 1
  • 9
0
votes
0 answers

The buffer allocated is insufficient when encoding to Rgba16 UWP

I am encoding a Canvas control which contains Textblocks as child using the following code but I get The buffer allocated is insufficient My code using(InMemoryRandomAccessStream ras = new InMemoryRandomAccessStream()) { var displayInformation…
PutraKg
  • 2,226
  • 3
  • 31
  • 60
1
2