imwrite fails for small images less than 64 rows high

1 ビュー (過去 30 日間)
Varun Munjal
Varun Munjal 2014 年 6 月 30 日
回答済み: Anand 2014 年 7 月 1 日
If I create an unsigned 16 bit array which is greater than 8192 columns wide and try to write it as a tiff image, it seems like it needs to be at least 64 rows high or Matlab 2014a throws an exception. To get around it, the 'RowsPerStrip' tag needs to be set manually to an integer value.
e.g:
x = ones([63 8192], 'uint16');
imwrite(x, 'C:\test\test.tif', 'tiff', 'Compression', 'none');
works fine.
BUT:
x = ones([63 8193], 'uint16');
imwrite(x, 'C:\test\test.tif', 'tiff', 'Compression', 'none');
gives an exception:
Error using wtifc
TIFF library error - '_TIFFVSetField: 4x8000.tif: Bad value 0 for "RowsPerStrip" tag.'
HOWEVER:
x = ones([64 8193], 'uint16');
imwrite(x, 'C:\test\test.tif', 'tiff', 'Compression', 'none');
works fine.
ALSO:
x = ones([63 8193], 'uint16');
imwrite(x, 'C:\test\test.tif', 'tiff', 'Compression', 'none', 'RowsPerStrip', 16);
works fine.
This was not a problem in 2011b

採用された回答

Anand
Anand 2014 年 7 月 1 日
This looks like a bug.
Please contact MathWorks Tech Support by creating a Service Request:

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by