summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/im_format_sgi.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/im_format_sgi.cpp b/src/im_format_sgi.cpp
index 08bbf4d..695340b 100644
--- a/src/im_format_sgi.cpp
+++ b/src/im_format_sgi.cpp
@@ -2,7 +2,7 @@
* \brief SGI - Silicon Graphics Image File Format
*
* See Copyright Notice in im_lib.h
- * $Id: im_format_sgi.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $
+ * $Id: im_format_sgi.cpp,v 1.3 2011/01/19 16:28:59 scuri Exp $
*/
#include "im_format.h"
@@ -300,9 +300,13 @@ int imFileFormatSGI::ReadImageInfo(int index)
switch (dimension)
{
case 1:
+ // If this value is 1, the image file consists of only 1 channel and only 1 scanline (row).
+ // Only width is valid.
this->height = 1;
depth = 1;
case 2:
+ // If this value is 2, the file consists of a single channel with a number of scanlines.
+ // Only width and height are valid.
depth = 1;
break;
case 3:
@@ -319,6 +323,10 @@ int imFileFormatSGI::ReadImageInfo(int index)
case 1:
this->file_color_mode = IM_GRAY;
break;
+ case 2:
+ // This is NOT mentioned by the specification, but it is used
+ this->file_color_mode = IM_GRAY | IM_ALPHA;
+ break;
case 3:
this->file_color_mode = IM_RGB;
break;
@@ -411,6 +419,13 @@ int imFileFormatSGI::WriteImageInfo()
if (imColorModeHasAlpha(this->user_color_mode))
this->file_color_mode |= IM_ALPHA;
}
+ else if (this->file_color_mode == IM_GRAY &&
+ imColorModeHasAlpha(this->user_color_mode))
+ {
+ // This is NOT mentioned by the specification, but it is used
+ dimension = 3;
+ this->file_color_mode |= IM_ALPHA;
+ }
this->file_data_type = this->user_data_type;