 ERROR: unimplemented-color-type image ;
 
 : inflate-data ( loading-png -- bytes )
-    find-compressed-bytes zlib-inflate ; 
+    find-compressed-bytes zlib-inflate ;
 
 : png-components-per-pixel ( loading-png -- n )
     color-type>> {
+        { greyscale [ 1 ] }
         { truecolor [ 3 ] }
+        { greyscale-alpha [ 2 ] }
         { truecolor-alpha [ 4 ] }
         [ unknown-color-type ]
     } case ; inline

    [ [ png-components-per-pixel ] [ bit-depth>> ] bi * ]
    [ width>> ] bi * 1 + ;

:: paeth ( a b c -- p ) 
    a b + c - { a b c } [ [ - abs ] keep 2array ] with map 
    sort-keys first second ;

:: png-unfilter-line ( width prev curr filter -- curr' )

        { filter-up [ [| n | n x nth n b nth + 256 wrap n x set-nth ] each ] }
        { filter-average [ [| n | n x nth n a nth n b nth + 2/ + 256 wrap n x set-nth ] each ] }
        { filter-paeth [ [| n | n x nth n a nth n b nth n c nth paeth + 256 wrap n x set-nth ] each ] }
    } case
    curr width tail ;

:: reverse-png-filter ( lines n -- byte-array )
