Hello,
I have one image (see image attached) and I want to export that image from tiff to jpeg, but when I'm creating the image with Image.Create(), I received the following error: "Unable to get information about stream."
Stack Trace:
{Aurigma.GraphicsMill.Codecs.FileFormat RecognizeFormat(System.IO.Stream)}
at Aurigma.GraphicsMill.Codecs.ImageReader.RecognizeFormat(Stream stream)
at Aurigma.GraphicsMill.Codecs.ImageReader.Create(Stream stream)
at ImageProcessor.ManualTests.Program.Main(String[] args) in d:\code\projects\ImageProcessor\ImageProcessor.ManualTests\Program.cs:line 35
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Kind regards
I have one image (see image attached) and I want to export that image from tiff to jpeg, but when I'm creating the image with Image.Create(), I received the following error: "Unable to get information about stream."
const string path = @"D:\img_test.tiff";
const string outpath = @"D:\out.jpg";
using (var imageStream = new MemoryStream(File.ReadAllBytes(path)))
using (var exportedImageStream = new MemoryStream())
using (var imageReader = ImageReader.Create(imageStream))
using (var bitmap = imageReader.Frames[0].GetBitmap())
{
var jpegSettings = new JpegSettings { Quality = 100 };
bitmap.Save(exportedImageStream, jpegSettings);
File.WriteAllBytes(outpath, exportedImageStream.GetBuffer());
}Stack Trace:
{Aurigma.GraphicsMill.Codecs.FileFormat RecognizeFormat(System.IO.Stream)}
at Aurigma.GraphicsMill.Codecs.ImageReader.RecognizeFormat(Stream stream)
at Aurigma.GraphicsMill.Codecs.ImageReader.Create(Stream stream)
at ImageProcessor.ManualTests.Program.Main(String[] args) in d:\code\projects\ImageProcessor\ImageProcessor.ManualTests\Program.cs:line 35
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Kind regards