From: cristy Date: Sat, 12 May 2012 23:45:48 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5607 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dfc9c53591160b219c9bbfd286044a9677f9c4e9;p=imagemagick --- diff --git a/coders/mat.c b/coders/mat.c index 06ecfe668..b0b4ee8f1 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -778,14 +778,6 @@ MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader"); (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */ NEXT_FRAME: - /* Image is gray when no complex flag is set and 2D Matrix */ - if ((MATLAB_HDR.DimFlag == 8) && - ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) - { - image->type=GrayscaleType; - SetImageColorspace(image,GRAYColorspace,exception); - } - switch (CellType) { case miINT8: @@ -848,6 +840,14 @@ MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader"); image->colors = one << image->depth; if (image->columns == 0 || image->rows == 0) goto MATLAB_KO; + /* Image is gray when no complex flag is set and 2D Matrix */ + if ((MATLAB_HDR.DimFlag == 8) && + ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) + { + image->type=GrayscaleType; + SetImageColorspace(image,GRAYColorspace,exception); + } + /* ----- Create gray palette ----- */