"Mathew Thomas" <
math...@gmail.com> wrote in message 
news:j8qokr$bie$1...@newscl01ah.mathworks.com...
> Hi All,
>
> I have a 100 X 100 array (values between 0.1 and 3) in the MATLAB 
> workspace that I am trying to save as Tiff file using the following code:
> imwrite(abs_smooth,'outfile', 'tif', 'Compression','none')
>
> Two things I noticed.
> 1) The size of the data reduces from 7 Mb to 1.5 Mb.
This is related to the cause of the second issue you mentioned:
> 2) The values are now around the range of 255 when I load the tiff file 
> back into MATLAB.
Correct. From the Class Support section of the documentation for IMWRITE:
http://www.mathworks.com/help/techdoc/ref/imwrite.html
"The class of the image written to the file depends on the format specified. 
For most formats, if the input array is of class uint8, imwrite outputs the 
data as 8-bit values. If the input array is of class uint16 and the format 
supports 16-bit data (JPEG, PNG, and TIFF), imwrite outputs the data as 
16-bit values. If the format does not support 16-bit values, imwrite issues 
an error. Several formats, such as JPEG and PNG, support a parameter that 
lets you specify the bit depth of the output data.
If the input array is of class double, and the image is a grayscale or RGB 
color image, imwrite assumes the dynamic range is [0,1] and automatically 
scales the data by 255 before writing it to the file as 8-bit values."
Your original data, abs_smooth, was a double array. What you received when 
you used IMREAD to import the data was probably uint8 data, the scaled 
version of your double data that was written by IMWRITE. Since 3, the upper 
limit of your original data, is outside the dynamic range [0 1] it saturated 
at intmax('uint8') or 255 when it was converted to a uint8. Doubles are 
larger than uint8's which explains the difference in the size of your data.
Your data doesn't fit the definitions of which I'm aware for grayscale, RGB, 
or indexed images; what were you expecting to receive when you converted it 
to a TIFF? With that information someone may be able to offer a suggestion 
on how to accomplish that goal.
http://www.mathworks.com/help/techdoc/creating_plots/f2-10709.html
-- 
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com