@@ -2613,10 +2613,13 @@ static MagickBooleanType WriteGROUP4Image(const ImageInfo *image_info,
26132613 (void ) SetImageType (huffman_image ,BilevelType ,exception );
26142614 write_info = CloneImageInfo ((ImageInfo * ) NULL );
26152615 SetImageInfoFile (write_info ,file );
2616- if (0 ) {
2617- (void ) SetImageDepth (image ,1 ,exception );
2618- (void ) SetImageType (image ,BilevelType ,exception );
2619- }
2616+ if (IsImageMonochrome (image ) != MagickFalse )
2617+ (void ) SetImageDepth (image ,1 ,exception );
2618+ else
2619+ {
2620+ (void ) SetImageType (image ,BilevelType ,exception );
2621+ (void ) SetImageDepth (image ,1 ,exception );
2622+ }
26202623 write_info -> compression = Group4Compression ;
26212624 write_info -> type = BilevelType ;
26222625 status = WriteTIFFImage (write_info ,huffman_image ,exception );
@@ -3491,7 +3494,10 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
34913494 case Group4Compression :
34923495 {
34933496 if (IsImageMonochrome (image ) != MagickFalse )
3494- break ;
3497+ {
3498+ (void ) SetImageDepth (image ,1 ,exception );
3499+ break ;
3500+ }
34953501 (void ) SetImageType (image ,BilevelType ,exception );
34963502 (void ) SetImageDepth (image ,1 ,exception );
34973503 break ;
0 commit comments