Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7934713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:43:02+00:00 2026-06-03T21:43:02+00:00

* strong text *I am trying to save a multi-page TIF file using the

  • 0

*strong text*I am trying to save a multi-page TIF file using the MATLAB TIFF class in 2012a by following the example in the documentation. My usage differs in that I am writing a 32-bit grayscale image with values ranging from approximately -10,000 to 200,000.

% Use 'a' for 'append' since this code is in a loop that writes each page.
% Note: 'fileName' is defined elsewhere and the file is created.
t = Tiff(fileName, 'a');

tagstruct.ImageLength = size(result, 2);
tagstruct.ImageWidth = size(result, 1);
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
tagstruct.Compression = Tiff.Compression.None;
tagstruct.BitsPerSample = 32;
tagstruct.SamplesPerPixel = 1;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = 'MATLAB';
t.setTag(tagstruct);

% Viewing the data immediately before the 'write' operation shows it correct.
% imtool(result(:, :, j));
% Tools -> Adjust Contrast                       
t.write(result(:, :, j));

t.close();

The output image, as inspected by both MATLAB and ImageJ, is the correct size and has the correct metadata, but all values are zero.

Update:

MATLAB’s documentation is somewhat sparse for the TIFF class, which itself is a wrapper for the LibTIFF library. The official TIFF Specification Version 6 denotes the full list of required fields for each TIF image type.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:43:03+00:00Added an answer on June 3, 2026 at 9:43 pm

    In the example of MATLAB documentation: Exporting to images there is one line which you don’t have in your code:

    tagstruct.RowsPerStrip = 16
    

    So maybe missing RowsPerStrip field of tagstruct is the cause of the image of all zeros.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to save a file using DialogResult and StringBuilder . After making
Hi i am trying to save text values as binary file and read from
I'm trying to get all the text from a txt file into a string,
I'm trying to save an XML file encoded as UTF-16 with cElementTree. This is
Hi, I am trying to save data using web services, jquery and json. From
I am trying to upload a file via a form and then save in
Im trying to download and save a file from a HttpWebResponse but im having
I am trying to save some files using C, with this code: sprintf(playerinput,%s,end); sprintf(fileloc,%s/.notend,getenv(HOME));
I am trying to retrieve particular parts of a string in a text file
I'm trying to save a simple string on a simple .plist file when the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.