2019-07-09 23:50:50 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2019-07-16 23:35:21 +02:00
|
|
|
|
namespace Toolbox.Library
|
2019-07-09 23:50:50 +02:00
|
|
|
|
{
|
|
|
|
|
public class ImageUtilty
|
|
|
|
|
{
|
|
|
|
|
public static byte[] ConvertBgraToRgba(byte[] bytes)
|
|
|
|
|
{
|
|
|
|
|
if (bytes == null)
|
|
|
|
|
throw new Exception("Data block returned null. Make sure the parameters and image properties are correct!");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < bytes.Length; i += 4)
|
|
|
|
|
{
|
|
|
|
|
var temp = bytes[i];
|
|
|
|
|
bytes[i] = bytes[i + 2];
|
|
|
|
|
bytes[i + 2] = temp;
|
|
|
|
|
}
|
|
|
|
|
return bytes;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|