0

i have 16 bit depth image after rotate image properties are changed like:- image size increase or decrease and bit depth 16 bit to 8 bit decreased.

expected rotated image properties like original image properties(Like:-both images size and bit depth should same)

check following code

Image img = Image.FromFile(sourceimagepath);
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
img.Save(rotatedimahepath);
img.Dispose();

here my source images are .TIFF images and image bit depth is 16 bit.

thanks.

Dileep
  • 81
  • 1
  • 1
  • 5
  • 3
    what's the question? – TerribleDog Dec 13 '18 at 05:38
  • 1
    `Save(..., ImageFormat.Tiff)`. By default it will be PNG. – Alexander Petrov Dec 13 '18 at 05:58
  • i am able to save Tiff also but the issue is bit depth is changing 16 bit to 8 bit, here i need after rotation also 16 bit image. – Dileep Dec 13 '18 at 07:22
  • @Dileep You solution workd for me and depth is not changing. Could you give an example of the image? – Belurd Dec 13 '18 at 15:15
  • If the image is 16-bit gray, `System.Drawing.Image` alone will not save it properly. Such images can have 65536 shades of gray. When you load it, it’s converted to `Format32bppArgb`. Although this format is 32-bit, it causes loss of data because it has 8-bits per channel for a maximum of 256 shades. To preserve the format of 16-bit gray images, you can use the BitmapSource class from PresentationCore Assembly of WPF as explained [here](https://stackoverflow.com/a/40179536), or use a professional imaging SDK like [LEADTOOLS](https://www.leadtools.com/help/sdk/v21/dh/to/grayscale-images.html). – Amin Dodin Jul 15 '21 at 10:45

0 Answers0