Questions tagged [bitmapencoder]

17 questions
7
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,480
  • 14
  • 24
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
  • 4,398
  • 2
  • 23
  • 34
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,147
  • 1
  • 24
  • 30
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,093
  • 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…
Andi AR
  • 315
  • 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,710
  • 6
  • 32
  • 63
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
  • 7,956
  • 3
  • 33
  • 59
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
  • 462
  • 7
  • 22
0
votes
0 answers

JPEG multipage tiff image is taking more time to save

I have 10MB+ Tiff files having 50 pages, and I want to perform rotation of all the pages by 90 degree at one click only, but after performing the rotation operations for each frames and when it comes to the Save(Encoder encoder) then…
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
  • 861
  • 4
  • 11
  • 28
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
  • 8
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,136
  • 3
  • 29
  • 57
0
votes
2 answers

PixelBuffer.AsStream() method obsolete?

I was checking the MS library. and it looks like PixelBuffer.AsStream() is obsolete for the Universal App development. I'm using Win10(build 10240) with VS2015 Community version. Do I miss anything ? Additionally, what's the best way to encode or…
Carl S.
  • 59
  • 1
  • 7
1
2