Hello,
If I try to convert any image to TGA using graphics mill and then convert the new exported TGA image to another format like JPEG, the image exported is all White. Could you please, provide me any information about this ?
Code Snippet
Graphics Mill version: 8.1.14
Kind regards
If I try to convert any image to TGA using graphics mill and then convert the new exported TGA image to another format like JPEG, the image exported is all White. Could you please, provide me any information about this ?
Code Snippet
static void Main(string[] args)
{
var image = File.ReadAllBytes(@"D:\img_test.jpg");
var tga = ExportToTga(image);
var jpeg = ExportToJpeg(tga);
File.WriteAllBytes(@"D:\img_exported.jpeg", jpg);
}
private static byte[] ExportToTga(byte[] image)
{
using (var tgaExported = new MemoryStream())
using (var reader = ImageReader.Create(new MemoryStream(image)))
using (var writer = new TgaWriter(tgaExported))
{
writer.Compression = CompressionType.Rle;
writer.ReducedPrecision = true;
Pipeline.Run(reader + writer);
return tgaExported.GetBuffer();
}
}
private static byte[] ExportToJpeg(byte[] image)
{
using (var jpegExported = new MemoryStream())
using (var reader = ImageReader.Create(new MemoryStream(image)))
using (var bitmap = reader.Frames[0].GetBitmap())
{
bitmap.Save(jpegExported, new JpegSettings { Quality = 85 });
return jpegExported.GetBuffer();
}
}Graphics Mill version: 8.1.14
Kind regards