kinow commented on a change in pull request #163:
URL: https://github.com/apache/commons-imaging/pull/163#discussion_r734943781



##########
File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
##########
@@ -824,44 +824,44 @@ public ImageInfo getImageInfo(final ByteSource 
byteSource, final Map<String, Obj
 
         // See 
http://docs.oracle.com/javase/6/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color
         ImageInfo.ColorType colorType = ImageInfo.ColorType.UNKNOWN;
-        // Some images have both JFIF/APP0 and APP14.
-        // JFIF is meant to win but in them APP14 is clearly right, so make it 
win.
-        if (app14Segment != null && app14Segment.isAdobeJpegSegment()) {
-            final int colorTransform = app14Segment.getAdobeColorTransform();
-            switch (colorTransform) {
-            case App14Segment.ADOBE_COLOR_TRANSFORM_UNKNOWN:
-                if (numberOfComponents == 3) {
-                    colorType = ImageInfo.ColorType.RGB;
-                } else if (numberOfComponents == 4) {
-                    colorType = ImageInfo.ColorType.CMYK;
+        switch (numberOfComponents) {
+        case 1:
+            colorType = ImageInfo.ColorType.GRAYSCALE;
+            break;
+        case 2:
+            colorType = ImageInfo.ColorType.GRAYSCALE;
+            transparent = true;
+            break;
+        case 3:
+        case 4:
+            // Some images have both JFIF/APP0 and APP14.
+            // JFIF is meant to win but in them APP14 is clearly right, so 
make it win.
+            if (app14Segment != null && app14Segment.isAdobeJpegSegment()) {
+                final int colorTransform = 
app14Segment.getAdobeColorTransform();
+                switch (colorTransform) {
+                case App14Segment.ADOBE_COLOR_TRANSFORM_UNKNOWN:
+                    if (numberOfComponents == 3) {
+                        colorType = ImageInfo.ColorType.RGB;
+                    } else if (numberOfComponents == 4) {
+                        colorType = ImageInfo.ColorType.CMYK;
+                    }
+                    break;
+                case App14Segment.ADOBE_COLOR_TRANSFORM_YCbCr:
+                    colorType = ImageInfo.ColorType.YCbCr;
+                    break;
+                case App14Segment.ADOBE_COLOR_TRANSFORM_YCCK:
+                    colorType = ImageInfo.ColorType.YCCK;
+                    break;
+                default:
+                    break;
                 }
-                break;
-            case App14Segment.ADOBE_COLOR_TRANSFORM_YCbCr:
-                colorType = ImageInfo.ColorType.YCbCr;
-                break;
-            case App14Segment.ADOBE_COLOR_TRANSFORM_YCCK:
-                colorType = ImageInfo.ColorType.YCCK;
-                break;
-            default:
-                break;
-            }
-        } else if (jfifSegment != null) {
-            if (numberOfComponents == 1) {
-                colorType = ImageInfo.ColorType.GRAYSCALE;
-            } else if (numberOfComponents == 3) {
-                colorType = ImageInfo.ColorType.YCbCr;
-            }
-        } else {
-            switch (numberOfComponents) {
-            case 1:
-                colorType = ImageInfo.ColorType.GRAYSCALE;
-                break;
-            case 2:
-                colorType = ImageInfo.ColorType.GRAYSCALE;
-                transparent = true;
-                break;
-            case 3:
-            case 4:
+            } else if (jfifSegment != null) {
+                if (numberOfComponents == 1) {

Review comment:
       ping :-)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to