/// <summary> /// Определить тип формата изображения /// </summary> private static ImageFormat ImageFormatToDrawing(ImageFormatApplication imageFormat) => imageFormat switch {
/// <summary> /// Повернуть изображение /// </summary> public static byte[] RotateImageInByte(byte[] signatureImage, ImageRotation imageRotation, ImageFormatApplication imageFormat) { if (signatureImage == null) { return(null); } using var streamIn = new MemoryStream(signatureImage, 0, signatureImage.Length); streamIn.Write(signatureImage, 0, signatureImage.Length); var image = Image.FromStream(streamIn, true); image.RotateFlip(ImageRotationToRotateFlipType(imageRotation)); var streamOut = new MemoryStream(); image.Save(streamOut, ImageFormatToDrawing(imageFormat)); return(streamOut.ToArray()); }