Quantcast
Channel: magick Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1011

Commented Unassigned: Write to stream [1187]

$
0
0
Hi,

When attempting to convert an image and write it to a stream (or bytearray) the conversion is somehow corrupted in the process.

```
var outputStream = new MemoryStream();
using (var magickImage = new MagickImage(src.InputStream, new MagickReadSettings
{
Format = MagickFormat.Jpeg
}))
{
magickImage.Format = MagickFormat.Tiff64;
magickImage.CompressionMethod = CompressionMethod.Group4;
magickImage.ColorSpace = ColorSpace.GRAY;
magickImage.Write(outputStream);
// magickImage.Write("test.tiff") // works :/
}
File.WriteAllBytes("test.tiff", outputStream.ToArray()); // corrupted
```
Comments: ** Comment from web user: dlemstra **

When you write to a file the extension of that will be used as the format and not the .Format you are setting. This means that _magickImage.Write("test.tiff")_ will write a normal tiff instead of a 64 bit tiff. _magickImage.Write(outputStream)_ will write a 64 bit tiff but it seems the default photo viewer on Windows does not support this format. The image is not corrupted, you can open it with a new MagickImage and write it as a png.


Viewing all articles
Browse latest Browse all 1011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>