0

Using System.Drawing, it is easy to get the HorizontalResolution and VerticalResolution of an image file.

In .NET 6, System.Drawing.common will be disabled (by default) and unsupported in other platform than Windows.

I try to get an equivalent with another framework. Microsoft recommends to migrate to SkiaSharp or ImageSharp.

I need the support of Jpeg, Png, Bmp and Tiff (single and multi)

In SkiaSharp, there is no support of image resolution (read and write)...

In ImageSharp, they doesn't support Tiff files

How can I get/set the resolution of those 4 images formats in a net5.0 (and soon net6.0) multiplatform (Win, Mac and Linux) app ?

Whiletrue
  • 551
  • 1
  • 7
  • 18
  • 1
    Image files generally have a header with metadata including horizontal and vertical measurements. Maybe look at the file format specs and write your own, it's not hard. – Neil Oct 07 '21 at 15:25
  • ImageSharp V2 will support Tiff files. You can get use the latest development builds for now. – James South Oct 21 '21 at 03:00
  • The [LEADTOOLS NuGet Packages](https://www.leadtools.com/downloads/nuget) support these image formats and many others on multiple .NETStandard platforms including Windows, Linux and OSX. (Disclosure: I work for its vendor). You can read the Leadtools.RasterImage.XResolution and YResolution properties after loading an image and you can set new values then save them back to file using the Leadtools.RasterCodecs class. There’s a [free evaluation here](https://www.leadtools.com/downloads) – Amin Dodin Nov 29 '21 at 16:23

1 Answers1

0

ImageSharp V2 is out and supports TIFF, see NuGet

Ynse01
  • 24
  • 3