-
Notifications
You must be signed in to change notification settings - Fork 80
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
WIP: add encoding with compression, additional tags, float support and bigtiff #80
WIP: add encoding with compression, additional tags, float support and bigtiff #80
Conversation
We have a fork here: https://github.com/image-rs/lzw :) |
Yes but the merge request for tiff encoding is not in this fork. You want me to create a pull request ? Also where this fork will be published on cargo ? We will need a new name no ? |
No, please don't move the PR outright. The encoder of |
Ok i don't touch the PR 😄 |
Use struct for Colortype Add support for f32 and f64 Allow to write multiples tags
Lot of changes to be able to encode any tags. I rewrite all the TiffValues in an enum and use a struct for the ColorTypes (why use a trait to store vars ?). |
I would rather evaluate if the approach is correct first instead of risking that big tiff will require large changes 🙂 You've observed that |
😢 Yeah you are right a simple function would have been easier 😞 For the bigtiff in fact it's pretty simple, if you implement the bigtiff you have implemented the tiff, it's juste the size of the ifd that change from u32 to u64 (and some header parameters) my scheme here #47 (comment) help to see witch part are different.
So we only need to use u64 for the offsets and we have the compatibility to BigTiff. I think i will be able to do it in separate branch. My main issue is with the value of the tag decoded that are now all on 8 bytes. So i read put everything in a u64 and it's only when i call the read method that i choose to read_long or read_long8 if the decoder have detected big tiff or not. So i have to rewrite all the |
I am splitting this PR in multiple smaller PR but i need to wait for the PR #84 to be merged before adding the support of lzw compression (it will simply add parameter to the extended function introduced by the PR). |
I haven't abandoned #70; I just have very little time for OSS projects until September. Any implementation of floating point is going to look at least in part identical to #70, so you're welcome to use it as a starting point for a new PR if you want to wrap up the last necessary part, the predictor. |
Ok i will do my best to implement the missing part ;) |
@Farkal Now that float support and BitTiff have landed as part of other PRs, do you want to rebase the remaining parts? The |
So you think i should rewrite the compression without using the |
The |
So I think we should just use the |
Yes. |
As the other PR have been merged this one doesn't need to stay open 😉 |
This is a work in progress and i need some advice about the implementation.
First the lzw lib is unmaintained but there is a fork in image-rs but there is not this pull request merged nwin/lzw#1. To enable the tiff encoding with lzw we need this.
Then I think there is a better way to encode the value to bytes but i didn't find it so i create new
TiffWriter
:/And the big issue is with the
additional_tags
i can't find a way to allow to pass an array of object implementing the traitTiffValue
withVec<(Tag, Box<dyn TiffValue>)>
, the compiler complain:So currently you can only use one type of TiffValue and need to specify it when you write the image or create the encoder like the colortype 😢