image file saved using tiff library (.tif)appear white in explorer and paintbrush

29 views (last 30 days)
I used tiff library (data type single) to save image file.The saved file can be read properly using imread and displayed using imshow. however when I see it in explorer the file thumbnail appears white. when opened in paint brush or any other editor it appears white.I am currently on Mac 10.9.5. However in windows too it appears white.
input_embedded_image is of type complex double.
A=single(real(input_embedded_image));
t = Tiff(filename, 'w');
tagstruct.ImageLength = size(A, 1);
tagstruct.ImageWidth = size(A, 2);
tagstruct.Compression = Tiff.Compression.None;
tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 32;
tagstruct.SamplesPerPixel = 1;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
t.setTag(tagstruct);
t.write(A);
t.close();

Answers (3)

Jan
Jan on 16 Oct 2016
It sounds like your image does not only look white, but simply is white. If the pixel values are defined as e.g. UINT8, the conversion by single let all values but 0 appear white, because they are greater than 1.0 . Please explain the purpose of:
A = single(real(input_embedded_image))
Are you sure that this has the desired effects?
  3 Comments
Jan
Jan on 19 Oct 2016
Summary: You can create a TIFF image in Matlab, which can be displayed by Matlab correctly, but not by the Windows Explorer and PaintBrush. Conclusion: Teh Windows Explorer and PaintBrush are less powerful at the interpretation of TIFF that Matlab is. If you insist on using this specific TIFF format, you cannot handle it by the Windows Explorer and PaintBrush. So how can we help you?

Sign in to comment.


Image Analyst
Image Analyst on 16 Oct 2016
I'm not that familiar with saving floating point images in TIFF format. Maybe it's possible - I just never do it. Integer is much more common, and perhaps those other programs you tried to use only understand images if they're integer. What happens if you cast the image to integer, uint16 or uint8 instead, or just leave it as integer since I think that it must be integer already otherwise you would not be casting it to single?
  2 Comments
Harshula Tulapurkar
Harshula Tulapurkar on 17 Oct 2016
thanks for your response. I need to embed watermark in the image. so using USFFT(curve let transform) to embed it. USFFT gives output in double complex. If i convert them to integer then i am unable to retrieve water mark. so keeping them floating point is essential.
Image Analyst
Image Analyst on 17 Oct 2016
I could be wrong, but think that other programs, like Photoshop or Windows Picture viewer, will probably not be able to read or understand complex floating point images.

Sign in to comment.


Walter Roberson
Walter Roberson on 19 Oct 2016
filename = 'testtifffp.tiff';
A = sort(single(randn(480,320, 3)),2);
t = Tiff(filename, 'w');
tagstruct.ImageLength = size(A, 1);
tagstruct.ImageWidth = size(A, 2);
tagstruct.Compression = Tiff.Compression.None;
tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 32;
tagstruct.SamplesPerPixel = size(A,3);
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
t.setTag(tagstruct);
t.write(A);
t.close();
This works on my OS-X El Capitan (10.11), producing a color icon for 3D A and a patterned non-white icon for 2D A. I also fired up a 10.9 (Mavericks) virtual machine and confirmed that the icon showed up the same there.
I did not try COMPLEXIEEEFP.
OS-X does not have Explorer, so I do not know where the reference to Explorer came from, unless you are copying to a different system?

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!