// DIE's signature file
// Author: LinXP
// doc-ref: http://www.libpng.org/pub/mng/spec/jng.html

init("image","JPEG Network Graphics (.JNG)");

function detect(bShowType,bShowVersion,bShowOptions)
{
    if(Binary.getSize()>=0x40)
    {
        if(Binary.compare("8B'JNG\r\n'1A0A........'JHDR'"))
        {
            bDetected=true;
            if(Binary.isVerbose())
            {
                sOption(Binary.read_uint32(0x10,_BE)+"x"+Binary.read_uint32(0x14,_BE));
                switch(File.read_uint8(0x18))
                {
                    case  8: sOption("Gray");        break;
                    case 10: sOption("Color");       break;
                    case 12: sOption("Gray Alpha");  break;
                    case 14: sOption("Color Alpha"); break;
                    default: bDetected=false;
                }
            }
        }
    }

    return result(bShowType,bShowVersion,bShowOptions);
}