Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Tiff support. #12

Closed
16 of 25 tasks
JimBobSquarePants opened this issue Oct 30, 2016 · 45 comments · Fixed by #1553
Closed
16 of 25 tasks

No Tiff support. #12

JimBobSquarePants opened this issue Oct 30, 2016 · 45 comments · Fixed by #1553

Comments

@JimBobSquarePants
Copy link
Member

JimBobSquarePants commented Oct 30, 2016

From @JimBobSquarePants on August 31, 2016 1:49

We should be able to support TIFF

Useful links.

http://partners.adobe.com/public/developer/tiff/index.html

http://www.remotesensing.org/libtiff/

http://www.awaresystems.be/imaging/tiff.html

Current implementation can be found in the tiff-codec branch.

Feature Checklist

  • Reading TIFF file structure
  • Parsing of relevant metadata
  • Extraction of image data blocks
  • Construction of image (from strip data)
  • Construction of image (from tile data)

Compression Types

  • None
  • Ccitt1D
  • PackBits
  • CcittGroup3Fax
  • CcittGroup4Fax
  • Lzw
  • Old Jpeg
  • Jpeg (Technote 2)
  • Deflate (Technote 2)
  • Old Deflate (Technote 2)

Photometric Interpretation Formats

  • WhiteIsZero
  • BlackIsZero
  • Rgb (Chunky)
  • Rgb (Planar)
  • PaletteColor
  • TransparencyMask
  • Separated (TIFF Extension color spaces)
  • YCbCr (TIFF Extension color spaces)
  • CieLab (TIFF Extension color spaces)
  • IccLab (TechNote 1)
@JimBobSquarePants
Copy link
Member Author

From @kierenj on September 7, 2016 20:27

I realise how unhelpful this comment right here is, but TIFF decoding across the board can be really tricky to get right - there are loads of compression formats, and even fairly respected tools (from MS / Atalasoft) get it wrong even with 1-bit images. I think some archiving formats even require special licensing to implement correctly. It might be worth identifying a small subset of formats to support!

@JimBobSquarePants
Copy link
Member Author

@kierenj It's certainly not an unhelpful comment. Tiff would be hard and I'm sorely tempted to let someone else figure it out and concentrate on what we have already. I'm just dreading the day someone tells me that the library is useless without it. There's always someone!

@ChrisVanDijk
Copy link

I needed to import Tiff files so I created a temporary Tiff encoder and decoder based on LibTiff.Net.

@JimBobSquarePants
Copy link
Member Author

@ChrisVanDijk Good effort but have you benchmarked that codec? The Bitmiracle jpeg codec was about 10x slower and used 190MB more to process a small test image compared to our codec. I imagine the Tiff one will be the same. I'd be careful using it.

@Andy-Wilkinson you have been playing around with Tiff haven't you with your own stuff? I wonder if we can use some of it?

@ChrisVanDijk
Copy link

@JimBobSquarePants The code and performance is bad, but I really needed the ability to open Tiff files. It's a temporary solution until a better one.

@JimBobSquarePants
Copy link
Member Author

@ChrisVanDijk understandable. Tiff is a complex format so I'm pushing it to the backburner until I can get everything else out of the way... Not looking forward to tackling it!

@antonfirsov
Copy link
Member

@ChrisVanDijk @JimBobSquarePants One big "advantage" of these naive C ports is that its really not that hard to make the first steps towards speeding & cleaning them up.
Someone with time & a profiler could check it, and estimate the efforts needed reuse/refactor elements of that code.

@Andy-Wilkinson
Copy link
Contributor

@JimBobSquarePants I've got the basics of reading the Tiff format itself working from my own project (I started here since many Camera Raw files are mutant Tiff files). As you mention, there are a number of compression formats, but the key ones probably aren't too much trouble. The one issue with my existing codebase is that it was a bit of an experiment in a more functional style of C#, rather than how you might structure it normally.

All that said, I know a fair amount about the Tiff format now, so probably would be able to make a quick start on a true ImageSharp Tiff codec pretty easily (and share a bit of the code where I can). Would you be interested in me picking up this issue and giving it a start? (especially since you guys seem to be busy enough with the existing codec perf 😄)

@JimBobSquarePants
Copy link
Member Author

@antonfirsov I've found with those ports though there's about a million lines more code than I'd like to read nested in there.

@Andy-Wilkinson That would be absolutely brilliant if you could! 💯

@sandorfr
Copy link

sandorfr commented Aug 3, 2017

I come across this library https://github.com/BitMiracle/libtiff.net which is already .netstandard compatible.
It's under new BSD license https://github.com/BitMiracle/libtiff.net/blob/master/license.txt

I feel like this is a good candidate to bring support for TIFF.

What do you think?

@JimBobSquarePants
Copy link
Member Author

@sandorfr We've already got a WIP TIFF PR in progress #119

The BitMiracle repositories, to put it nicely, are junk. Poorly ported, slow, bloated implementations that are useful only for testing against.

@Andy-Wilkinson
Copy link
Contributor

@poeman16 : Unfortunately I've had pretty much zero time to devote to working on this pull request for a while. The foundations of parsing the TIFF structure was mostly in place, with the most complex area remaining being implementations for the different compression formations, in particular those based on JPEG. There would need to be some changes to fit with any changes in the ImageSharp design since the last commit. Definitely something that could be picked up by someone.

@JimBobSquarePants
Copy link
Member Author

There's been a lot of changes in the main repo since the PR was opened. We'll have to do a lot of work to update the codebase before support can be completed.

@JimBobSquarePants JimBobSquarePants added this to the Future milestone Dec 10, 2018
@darl0026
Copy link

Are there any plans to support TIFF in the future, im using your library for viewing/editing Exif data

@JimBobSquarePants
Copy link
Member Author

Yep, we have a Tiff branch with a lot of code written already. Post v1 we will work to complete it.

@damianog
Copy link

Hi @JimBobSquarePants
as the others I am interested on a Tiff decoder. I need to process multipage Tiff documents from office scanner.
Thanks in advance.

@IldarKhayrutdinov
Copy link
Contributor

IldarKhayrutdinov commented Aug 9, 2019

@antonfirsov @JimBobSquarePants @Andy-Wilkinson Can I contribute to the tiff-codec branch?
I would like to commits to my branch IldarKhayrutdinov/ImageSharp/tiff-codec then create PR to the SixLabors/ImageSharp/tiff-codec.

@antonfirsov
Copy link
Member

@IldarKhayrutdinov that would be ace! 🚀

IldarKhayrutdinov added a commit to IldarKhayrutdinov/ImageSharp that referenced this issue Aug 13, 2019
IldarKhayrutdinov added a commit to IldarKhayrutdinov/ImageSharp that referenced this issue Aug 13, 2019
IldarKhayrutdinov added a commit to IldarKhayrutdinov/ImageSharp that referenced this issue Aug 13, 2019
IldarKhayrutdinov added a commit to IldarKhayrutdinov/ImageSharp that referenced this issue Aug 13, 2019
JimBobSquarePants pushed a commit that referenced this issue Feb 17, 2021
JimBobSquarePants added a commit that referenced this issue Feb 17, 2021
JimBobSquarePants added a commit that referenced this issue Feb 17, 2021
JimBobSquarePants pushed a commit that referenced this issue Feb 17, 2021
JimBobSquarePants pushed a commit that referenced this issue Feb 17, 2021
JimBobSquarePants added a commit that referenced this issue Feb 17, 2021
JimBobSquarePants added a commit that referenced this issue Feb 17, 2021
#12 Use exif reader for tiff tags reading
JimBobSquarePants pushed a commit that referenced this issue Feb 17, 2021
#12 Support multi strip encoding. Improve performance and memory usage.
JimBobSquarePants pushed a commit that referenced this issue Feb 17, 2021
JimBobSquarePants added a commit that referenced this issue Feb 17, 2021
JimBobSquarePants added a commit that referenced this issue Feb 17, 2021
JimBobSquarePants pushed a commit that referenced this issue Feb 17, 2021
JimBobSquarePants pushed a commit that referenced this issue Feb 17, 2021
JimBobSquarePants added a commit that referenced this issue Feb 17, 2021
JimBobSquarePants added a commit that referenced this issue Feb 17, 2021
#12 Use exif reader for tiff tags reading
JimBobSquarePants pushed a commit that referenced this issue Feb 17, 2021
#12 Support multi strip encoding. Improve performance and memory usage.
@brianpopow brianpopow linked a pull request Feb 17, 2021 that will close this issue
17 tasks
@JimBobSquarePants JimBobSquarePants modified the milestones: Future, 1.1.0 Mar 15, 2021
@JimBobSquarePants JimBobSquarePants unpinned this issue May 25, 2021
@brianpopow
Copy link
Collaborator

I am happy to announce that we have now support for decoding and encoding Tiff images with #1553 merged to the master branch.

You can try it out with our nightly build from our myget feed

For now this feature has to be activated manually by the user, which can be done in several different ways:

  1. Add Tiff to the Default Configuration:
Configuration.Default.AddTiff();
  1. Or to your specific configuration:
Configuration config = new Configuration();
config.AddTiff();
  1. Provide the Tiff Decoder / Encoder explicit when loading or saving a image:
using var image = Image.Load(@"image.tiff", new TiffDecoder());

@JimBobSquarePants
Copy link
Member Author

@brianpopow let’s make that automatic. 🙂

@brianpopow
Copy link
Collaborator

@brianpopow let’s make that automatic. 🙂

With #1634 merged, the Tiff format is now added to the default Configuration.

@cocosip
Copy link

cocosip commented Dec 31, 2021

Hi, i try to read a tiff image, but it throw Tiled images are not supported.
Any plan to support Construction of image (from tile data) ?
Thank you!

@JimBobSquarePants
Copy link
Member Author

No plans currently. That would require community support to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.