0

I'm looking for a way of creating a multi-page TIFF image in NET 6 (console app). I still have an option to switch back to NET 4.8, but I would try to avoid it.

Is there any way to use BitmapSource, TiffBitmapEncoder, etc from the NET 6 console app?

  • Q: Is it Is it possible to create a TIFF image in NET 6? A: Sure. there are lots of good alternatives. STRONG SUGGESTION: Write a little "Hello world" C# console app, specify your target platform (e.g. .Net 6) and try this (specifying "TIFF" output): https://learn.microsoft.com/en-us/dotnet/api/system.drawing.image.save?view=dotnet-plat-ext-6.0 – paulsm4 Aug 23 '22 at 21:32

1 Answers1

1

The ImageSharp library has a TiffEncoder, that should probably suit your needs.

If you can't use or don't want to use this external library, for some reason, you could pick the relevant parts from the source code available (see link to the TIFF file given above), that may need some work, though.

Otherwise, you can at least try to isolate the problem of using .NET Framework 4.8 by creating a .NET standard solution, so you can still have some code using .NET 6.

Pac0
  • 21,465
  • 8
  • 65
  • 74
  • About the .NET standard part: I think that would mean you must use a 4.8 console project, but you can still most of the code in a another library project that is written in .NET 6, targetting .NET standard 2.0. Not sure if helps you in your case. – Pac0 Aug 23 '22 at 21:31
  • I'm not sure I'd suggest a (paid?) 3rd party library like ImageSharp as my first choice. And I'm definitely not sure why you say you'd have to "go back" to anything. I haven't actually tried it myself, but I'd be surprised if the OP couldn't do everything he needed with what's available with .Net 6. – paulsm4 Aug 23 '22 at 21:35
  • @paulsm4 You're right, and the simplest proof is that OP could probably take the source code of ImageSharp from github, and voilà. I'll check and amend my answer. – Pac0 Aug 23 '22 at 21:40
  • (however, it doesn't seem that anything is readily available for that in .NET 6 itself, and the specs of the format are not so simple (see the links in the [readme of ImageSharp in the TIFF folder](https://github.com/SixLabors/ImageSharp/blob/main/src/ImageSharp/Formats/Tiff/README.md)) – Pac0 Aug 23 '22 at 21:44