Tiff library to export Tiff image uint32
Show older comments
I don't know how exactly to use the tifflib code given by matlab. I have a uint32 image J on matlab and i want to export it in tiff. can anyone tell me how?
3 Comments
Rik
on 2 Jul 2018
Mirett Boliard
on 2 Jul 2018
Walter Roberson
on 2 Jul 2018
tagstruct.SampleFormat = Tiff.SampleFormat.Uint;
Answers (2)
Mirett Boliard
on 2 Jul 2018
0 votes
1 Comment
Rik
on 2 Jul 2018
Why the impatience? It has only been 20 minutes since you posted the question. People in Europe are probably sleeping or going to sleep, and the US/Canada are still in office hours. For most contributors this is something for their spare time. If you need answers this fast, consider hiring a consultant.
Also, this is not answer. Please only post an answer if you actually solve the question you posed.
Rik
on 2 Jul 2018
I generated an example with the line below
A=uint32(randi(uint32(inf),255,255));
Then, running your code resulted in this error:
If SampleFormat is IEEEFP, the image datatype is restricted
to one of the following: single, double.
So your choice of format is incompatible with your choice of input data type. There are two ways to fix this:
- Set tagstruct.SampleFormat = Tiff.SampleFormat.Uint;
- Cast your data to the single datatype with A=single(A);.
1 Comment
Rik
on 3 Jul 2018
Did this suggestion solve your problem? If so, please consider marking it as accepted answer. It will make it easier for other people with the same question to find an answer. If this didn't solve your question, please comment with what problems you are still having.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!