const tagsById: Record<number, string> = {
  // Baseline tags
  0x00fe: 'NewSubfileType',
  0x00ff: 'SubfileType',
  0x0100: 'ImageWidth',
  0x0101: 'ImageLength',
  0x0102: 'BitsPerSample',
  0x0103: 'Compression',
  0x0106: 'PhotometricInterpretation',
  0x0107: 'Threshholding',
  0x0108: 'CellWidth',
  0x0109: 'CellLength',
  0x010a: 'FillOrder',
  0x010e: 'ImageDescription',
  0x010f: 'Make',
  0x0110: 'Model',
  0x0111: 'StripOffsets',
  0x0112: 'Orientation',
  0x0115: 'SamplesPerPixel',
  0x0116: 'RowsPerStrip',
  0x0117: 'StripByteCounts',
  0x0118: 'MinSampleValue',
  0x0119: 'MaxSampleValue',
  0x011a: 'XResolution',
  0x011b: 'YResolution',
  0x011c: 'PlanarConfiguration',
  0x0120: 'FreeOffsets',
  0x0121: 'FreeByteCounts',
  0x0122: 'GrayResponseUnit',
  0x0123: 'GrayResponseCurve',
  0x0128: 'ResolutionUnit',
  0x0131: 'Software',
  0x0132: 'DateTime',
  0x013b: 'Artist',
  0x013c: 'HostComputer',
  0x0140: 'ColorMap',
  0x0152: 'ExtraSamples',
  0x8298: 'Copyright',

  // Extension tags
  0x010d: 'DocumentName',
  0x011d: 'PageName',
  0x011e: 'XPosition',
  0x011f: 'YPosition',
  0x0124: 'T4Options',
  0x0125: 'T6Options',
  0x0129: 'PageNumber',
  0x012d: 'TransferFunction',
  0x013d: 'Predictor',
  0x013e: 'WhitePoint',
  0x013f: 'PrimaryChromaticities',
  0x0141: 'HalftoneHints',
  0x0142: 'TileWidth',
  0x0143: 'TileLength',
  0x0144: 'TileOffsets',
  0x0145: 'TileByteCounts',
  0x0146: 'BadFaxLines',
  0x0147: 'CleanFaxData',
  0x0148: 'ConsecutiveBadFaxLines',
  0x014a: 'SubIFDs',
  0x014c: 'InkSet',
  0x014d: 'InkNames',
  0x014e: 'NumberOfInks',
  0x0150: 'DotRange',
  0x0151: 'TargetPrinter',
  0x0153: 'SampleFormat',
  0x0154: 'SMinSampleValue',
  0x0155: 'SMaxSampleValue',
  0x0156: 'TransferRange',
  0x0157: 'ClipPath',
  0x0158: 'XClipPathUnits',
  0x0159: 'YClipPathUnits',
  0x015a: 'Indexed',
  0x015b: 'JPEGTables',
  0x015f: 'OPIProxy',
  0x0190: 'GlobalParametersIFD',
  0x0191: 'ProfileType',
  0x0192: 'FaxProfile',
  0x0193: 'CodingMethods',
  0x0194: 'VersionYear',
  0x0195: 'ModeNumber',
  0x01b1: 'Decode',
  0x01b2: 'DefaultImageColor',
  0x0200: 'JPEGProc',
  0x0201: 'JPEGInterchangeFormat',
  0x0202: 'JPEGInterchangeFormatLength',
  0x0203: 'JPEGRestartInterval',
  0x0205: 'JPEGLosslessPredictors',
  0x0206: 'JPEGPointTransforms',
  0x0207: 'JPEGQTables',
  0x0208: 'JPEGDCTables',
  0x0209: 'JPEGACTables',
  0x0211: 'YCbCrCoefficients',
  0x0212: 'YCbCrSubSampling',
  0x0213: 'YCbCrPositioning',
  0x0214: 'ReferenceBlackWhite',
  0x022f: 'StripRowCounts',
  0x02bc: 'XMP',
  0x800d: 'ImageID',
  0x87ac: 'ImageLayer',

  // Private tags
  0x80a4: 'WangAnnotatio',
  0x82a5: 'MDFileTag',
  0x82a6: 'MDScalePixel',
  0x82a7: 'MDColorTable',
  0x82a8: 'MDLabName',
  0x82a9: 'MDSampleInfo',
  0x82aa: 'MDPrepDate',
  0x82ab: 'MDPrepTime',
  0x82ac: 'MDFileUnits',
  0x830e: 'ModelPixelScaleTag',
  0x83bb: 'IPTC',
  0x847e: 'INGRPacketDataTag',
  0x847f: 'INGRFlagRegisters',
  0x8480: 'IrasBTransformationMatrix',
  0x8482: 'ModelTiepointTag',
  0x85d8: 'ModelTransformationTag',
  0x8649: 'Photoshop',
  0x8769: 'ExifIFD',
  0x8773: 'ICCProfile',
  0x87af: 'GeoKeyDirectoryTag',
  0x87b0: 'GeoDoubleParamsTag',
  0x87b1: 'GeoAsciiParamsTag',
  0x8825: 'GPSIFD',
  0x885c: 'HylaFAXFaxRecvParams',
  0x885d: 'HylaFAXFaxSubAddress',
  0x885e: 'HylaFAXFaxRecvTime',
  0x935c: 'ImageSourceData',
  0xa005: 'InteroperabilityIFD',
  0xa480: 'GDAL_METADATA',
  0xa481: 'GDAL_NODATA',
  0xc427: 'OceScanjobDescription',
  0xc428: 'OceApplicationSelector',
  0xc429: 'OceIdentificationNumber',
  0xc42a: 'OceImageLogicCharacteristics',
  0xc612: 'DNGVersion',
  0xc613: 'DNGBackwardVersion',
  0xc614: 'UniqueCameraModel',
  0xc615: 'LocalizedCameraModel',
  0xc616: 'CFAPlaneColor',
  0xc617: 'CFALayout',
  0xc618: 'LinearizationTable',
  0xc619: 'BlackLevelRepeatDim',
  0xc61a: 'BlackLevel',
  0xc61b: 'BlackLevelDeltaH',
  0xc61c: 'BlackLevelDeltaV',
  0xc61d: 'WhiteLevel',
  0xc61e: 'DefaultScale',
  0xc61f: 'DefaultCropOrigin',
  0xc620: 'DefaultCropSize',
  0xc621: 'ColorMatrix1',
  0xc622: 'ColorMatrix2',
  0xc623: 'CameraCalibration1',
  0xc624: 'CameraCalibration2',
  0xc625: 'ReductionMatrix1',
  0xc626: 'ReductionMatrix2',
  0xc627: 'AnalogBalance',
  0xc628: 'AsShotNeutral',
  0xc629: 'AsShotWhiteXY',
  0xc62a: 'BaselineExposure',
  0xc62b: 'BaselineNoise',
  0xc62c: 'BaselineSharpness',
  0xc62d: 'BayerGreenSplit',
  0xc62e: 'LinearResponseLimit',
  0xc62f: 'CameraSerialNumber',
  0xc630: 'LensInfo',
  0xc631: 'ChromaBlurRadius',
  0xc632: 'AntiAliasStrength',
  0xc634: 'DNGPrivateData',
  0xc635: 'MakerNoteSafety',
  0xc65a: 'CalibrationIlluminant1',
  0xc65b: 'CalibrationIlluminant2',
  0xc65c: 'BestQualityScale',
  0xc660: 'AliasLayerMetadata',
};

const tagsByName: Record<string, number> = {};
for (const i in tagsById) {
  tagsByName[tagsById[i]] = Number(i);
}

export { tagsById, tagsByName };
