⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tiffdump.c

📁 tiff文件开发库
💻 C
📖 第 1 页 / 共 2 页
字号:
    { TIFFTAG_OSUBFILETYPE,	"OldSubFileType" },    { TIFFTAG_IMAGEWIDTH,	"ImageWidth" },    { TIFFTAG_IMAGELENGTH,	"ImageLength" },    { TIFFTAG_BITSPERSAMPLE,	"BitsPerSample" },    { TIFFTAG_COMPRESSION,	"Compression" },    { TIFFTAG_PHOTOMETRIC,	"Photometric" },    { TIFFTAG_THRESHHOLDING,	"Threshholding" },    { TIFFTAG_CELLWIDTH,	"CellWidth" },    { TIFFTAG_CELLLENGTH,	"CellLength" },    { TIFFTAG_FILLORDER,	"FillOrder" },    { TIFFTAG_DOCUMENTNAME,	"DocumentName" },    { TIFFTAG_IMAGEDESCRIPTION,	"ImageDescription" },    { TIFFTAG_MAKE,		"Make" },    { TIFFTAG_MODEL,		"Model" },    { TIFFTAG_STRIPOFFSETS,	"StripOffsets" },    { TIFFTAG_ORIENTATION,	"Orientation" },    { TIFFTAG_SAMPLESPERPIXEL,	"SamplesPerPixel" },    { TIFFTAG_ROWSPERSTRIP,	"RowsPerStrip" },    { TIFFTAG_STRIPBYTECOUNTS,	"StripByteCounts" },    { TIFFTAG_MINSAMPLEVALUE,	"MinSampleValue" },    { TIFFTAG_MAXSAMPLEVALUE,	"MaxSampleValue" },    { TIFFTAG_XRESOLUTION,	"XResolution" },    { TIFFTAG_YRESOLUTION,	"YResolution" },    { TIFFTAG_PLANARCONFIG,	"PlanarConfig" },    { TIFFTAG_PAGENAME,		"PageName" },    { TIFFTAG_XPOSITION,	"XPosition" },    { TIFFTAG_YPOSITION,	"YPosition" },    { TIFFTAG_FREEOFFSETS,	"FreeOffsets" },    { TIFFTAG_FREEBYTECOUNTS,	"FreeByteCounts" },    { TIFFTAG_GRAYRESPONSEUNIT,	"GrayResponseUnit" },    { TIFFTAG_GRAYRESPONSECURVE,"GrayResponseCurve" },    { TIFFTAG_GROUP3OPTIONS,	"Group3Options" },    { TIFFTAG_GROUP4OPTIONS,	"Group4Options" },    { TIFFTAG_RESOLUTIONUNIT,	"ResolutionUnit" },    { TIFFTAG_PAGENUMBER,	"PageNumber" },    { TIFFTAG_COLORRESPONSEUNIT,"ColorResponseUnit" },    { TIFFTAG_TRANSFERFUNCTION,	"TransferFunction" },    { TIFFTAG_SOFTWARE,		"Software" },    { TIFFTAG_DATETIME,		"DateTime" },    { TIFFTAG_ARTIST,		"Artist" },    { TIFFTAG_HOSTCOMPUTER,	"HostComputer" },    { TIFFTAG_PREDICTOR,	"Predictor" },    { TIFFTAG_WHITEPOINT,	"Whitepoint" },    { TIFFTAG_PRIMARYCHROMATICITIES,"PrimaryChromaticities" },    { TIFFTAG_COLORMAP,		"Colormap" },    { TIFFTAG_HALFTONEHINTS,	"HalftoneHints" },    { TIFFTAG_TILEWIDTH,	"TileWidth" },    { TIFFTAG_TILELENGTH,	"TileLength" },    { TIFFTAG_TILEOFFSETS,	"TileOffsets" },    { TIFFTAG_TILEBYTECOUNTS,	"TileByteCounts" },    { TIFFTAG_BADFAXLINES,	"BadFaxLines" },    { TIFFTAG_CLEANFAXDATA,	"CleanFaxData" },    { TIFFTAG_CONSECUTIVEBADFAXLINES, "ConsecutiveBadFaxLines" },    { TIFFTAG_SUBIFD,		"SubIFD" },    { TIFFTAG_INKSET,		"InkSet" },    { TIFFTAG_INKNAMES,		"InkNames" },    { TIFFTAG_NUMBEROFINKS,	"NumberOfInks" },    { TIFFTAG_DOTRANGE,		"DotRange" },    { TIFFTAG_TARGETPRINTER,	"TargetPrinter" },    { TIFFTAG_EXTRASAMPLES,	"ExtraSamples" },    { TIFFTAG_SAMPLEFORMAT,	"SampleFormat" },    { TIFFTAG_SMINSAMPLEVALUE,	"SMinSampleValue" },    { TIFFTAG_SMAXSAMPLEVALUE,	"SMaxSampleValue" },    { TIFFTAG_JPEGPROC,		"JPEGProcessingMode" },    { TIFFTAG_JPEGIFOFFSET,	"JPEGInterchangeFormat" },    { TIFFTAG_JPEGIFBYTECOUNT,	"JPEGInterchangeFormatLength" },    { TIFFTAG_JPEGRESTARTINTERVAL,"JPEGRestartInterval" },    { TIFFTAG_JPEGLOSSLESSPREDICTORS,"JPEGLosslessPredictors" },    { TIFFTAG_JPEGPOINTTRANSFORM,"JPEGPointTransform" },    { TIFFTAG_JPEGTABLES,       "JPEGTables" },    { TIFFTAG_JPEGQTABLES,	"JPEGQTables" },    { TIFFTAG_JPEGDCTABLES,	"JPEGDCTables" },    { TIFFTAG_JPEGACTABLES,	"JPEGACTables" },    { TIFFTAG_YCBCRCOEFFICIENTS,"YCbCrCoefficients" },    { TIFFTAG_YCBCRSUBSAMPLING,	"YCbCrSubsampling" },    { TIFFTAG_YCBCRPOSITIONING,	"YCbCrPositioning" },    { TIFFTAG_REFERENCEBLACKWHITE, "ReferenceBlackWhite" },    { TIFFTAG_REFPTS,		"IgReferencePoints (Island Graphics)" },    { TIFFTAG_REGIONTACKPOINT,	"IgRegionTackPoint (Island Graphics)" },    { TIFFTAG_REGIONWARPCORNERS,"IgRegionWarpCorners (Island Graphics)" },    { TIFFTAG_REGIONAFFINE,	"IgRegionAffine (Island Graphics)" },    { TIFFTAG_MATTEING,		"OBSOLETE Matteing (Silicon Graphics)" },    { TIFFTAG_DATATYPE,		"OBSOLETE DataType (Silicon Graphics)" },    { TIFFTAG_IMAGEDEPTH,	"ImageDepth (Silicon Graphics)" },    { TIFFTAG_TILEDEPTH,	"TileDepth (Silicon Graphics)" },    { 32768,			"OLD BOGUS Matteing tag" },    { TIFFTAG_COPYRIGHT,	"Copyright" },    { TIFFTAG_ICCPROFILE,	"ICC Profile" },    { TIFFTAG_JBIGOPTIONS,	"JBIG Options" },    { TIFFTAG_STONITS,		"StoNits" },};#define	NTAGS	(sizeof (tagnames) / sizeof (tagnames[0]))static voidPrintTag(FILE* fd, uint16 tag){	register struct tagname *tp;	for (tp = tagnames; tp < &tagnames[NTAGS]; tp++)		if (tp->tag == tag) {			fprintf(fd, "%s (%u)", tp->name, tag);			return;		}	fprintf(fd, "%u (%#x)", tag, tag);}static voidPrintType(FILE* fd, uint16 type){	static char *typenames[] = {	    "0",	    "BYTE",	    "ASCII",	    "SHORT",	    "LONG",	    "RATIONAL",	    "SBYTE",	    "UNDEFINED",	    "SSHORT",	    "SLONG",	    "SRATIONAL",	    "FLOAT",	    "DOUBLE"	};#define	NTYPES	(sizeof (typenames) / sizeof (typenames[0]))	if (type < NTYPES)		fprintf(fd, "%s (%u)", typenames[type], type);	else		fprintf(fd, "%u (%#x)", type, type);}#undef	NTYPESstatic voidPrintByte(FILE* fd, const char* fmt, TIFFDirEntry* dp){	char* sep = "";	if (hdr.tiff_magic != TIFF_LITTLEENDIAN) {		switch ((int)dp->tdir_count) {		case 4: fprintf(fd, fmt, sep, dp->tdir_offset&0xff);			sep = " ";		case 3: fprintf(fd, fmt, sep, (dp->tdir_offset>>8)&0xff);			sep = " ";		case 2: fprintf(fd, fmt, sep, (dp->tdir_offset>>16)&0xff);			sep = " ";		case 1: fprintf(fd, fmt, sep, dp->tdir_offset>>24);		}	} else {		switch ((int)dp->tdir_count) {		case 4: fprintf(fd, fmt, sep, dp->tdir_offset>>24);			sep = " ";		case 3: fprintf(fd, fmt, sep, (dp->tdir_offset>>16)&0xff);			sep = " ";		case 2: fprintf(fd, fmt, sep, (dp->tdir_offset>>8)&0xff);			sep = " ";		case 1: fprintf(fd, fmt, sep, dp->tdir_offset&0xff);		}	}}static voidPrintShort(FILE* fd, const char* fmt, TIFFDirEntry* dp){	char *sep = "";	if (hdr.tiff_magic != TIFF_LITTLEENDIAN) {		switch (dp->tdir_count) {		case 2: fprintf(fd, fmt, sep, dp->tdir_offset&0xffff);			sep = " ";		case 1: fprintf(fd, fmt, sep, dp->tdir_offset>>16);		}	} else {		switch (dp->tdir_count) {		case 2: fprintf(fd, fmt, sep, dp->tdir_offset>>16);			sep = " ";		case 1: fprintf(fd, fmt, sep, dp->tdir_offset&0xffff);		}	}}static voidPrintLong(FILE* fd, const char* fmt, TIFFDirEntry* dp){	fprintf(fd, fmt, "", (long) dp->tdir_offset);}#include <ctype.h>static voidPrintASCII(FILE* fd, uint32 cc, const unsigned char* cp){	for (; cc > 0; cc--, cp++) {		const char* tp;		if (isprint(*cp)) {			fputc(*cp, fd);			continue;		}		for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)			if (*tp++ == *cp)				break;		if (*tp)			fprintf(fd, "\\%c", *tp);		else if (*cp)			fprintf(fd, "\\%03o", *cp);		else			fprintf(fd, "\\0");	}}static voidPrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data){	char* sep = "";	switch (type) {	case TIFF_BYTE:		while (count-- > 0)			fprintf(fd, bytefmt, sep, *data++), sep = " ";		break;	case TIFF_SBYTE:		while (count-- > 0)			fprintf(fd, sbytefmt, sep, *(char *)data++), sep = " ";		break;	case TIFF_UNDEFINED:		while (count-- > 0)			fprintf(fd, bytefmt, sep, *data++), sep = " ";		break;	case TIFF_ASCII:		PrintASCII(fd, count, data);		break;	case TIFF_SHORT: {		register uint16 *wp = (uint16*)data;		while (count-- > 0)			fprintf(fd, shortfmt, sep, *wp++), sep = " ";		break;	}	case TIFF_SSHORT: {		register int16 *wp = (int16*)data;		while (count-- > 0)			fprintf(fd, sshortfmt, sep, *wp++), sep = " ";		break;	}	case TIFF_LONG: {		register uint32 *lp = (uint32*)data;		while (count-- > 0) {			fprintf(fd, longfmt, sep, (unsigned long) *lp++);			sep = " ";		}		break;	}	case TIFF_SLONG: {		register int32 *lp = (int32*)data;		while (count-- > 0)			fprintf(fd, slongfmt, sep, (long) *lp++), sep = " ";		break;	}	case TIFF_RATIONAL: {		register uint32 *lp = (uint32*)data;		while (count-- > 0) {			if (lp[1] == 0)				fprintf(fd, "%sNan (%lu/%lu)", sep,				    (unsigned long) lp[0],				    (unsigned long) lp[1]);			else				fprintf(fd, rationalfmt, sep,				    (double)lp[0] / (double)lp[1]);			sep = " ";			lp += 2;		}		break;	}	case TIFF_SRATIONAL: {		register int32 *lp = (int32*)data;		while (count-- > 0) {			if (lp[1] == 0)				fprintf(fd, "%sNan (%ld/%ld)", sep,				    (long) lp[0], (long) lp[1]);			else				fprintf(fd, srationalfmt, sep,				    (double)lp[0] / (double)lp[1]);			sep = " ";			lp += 2;		}		break;	}	case TIFF_FLOAT: {		register float *fp = (float *)data;		while (count-- > 0)			fprintf(fd, floatfmt, sep, *fp++), sep = " ";		break;	}	case TIFF_DOUBLE: {		register double *dp = (double *)data;		while (count-- > 0)			fprintf(fd, doublefmt, sep, *dp++), sep = " ";		break;	}	}}/* * Fetch a contiguous directory item. */static intTIFFFetchData(int fd, TIFFDirEntry* dir, void* cp){	int cc, w;	w = (dir->tdir_type < NWIDTHS ? datawidth[dir->tdir_type] : 0);	cc = dir->tdir_count * w;	if (lseek(fd, (off_t) dir->tdir_offset, 0) == dir->tdir_offset &&	    read(fd, cp, cc) == cc) {		if (swabflag) {			switch (dir->tdir_type) {			case TIFF_SHORT:			case TIFF_SSHORT:				TIFFSwabArrayOfShort((uint16*) cp,				    dir->tdir_count);				break;			case TIFF_LONG:			case TIFF_SLONG:			case TIFF_FLOAT:				TIFFSwabArrayOfLong((uint32*) cp,				    dir->tdir_count);				break;			case TIFF_RATIONAL:				TIFFSwabArrayOfLong((uint32*) cp,				    2*dir->tdir_count);				break;			case TIFF_DOUBLE:				TIFFSwabArrayOfDouble((double*) cp,				    dir->tdir_count);				break;			}		}		return (cc);	}	Error("Error while reading data for tag %u", dir->tdir_tag);	return (0);}static voidReadError(char* what){	Fatal("Error while reading %s", what);}#include <stdarg.h>static voidvError(FILE* fd, const char* fmt, va_list ap){	fprintf(fd, "%s: ", curfile);	vfprintf(fd, fmt, ap);	fprintf(fd, ".\n");}static voidError(const char* fmt, ...){	va_list ap;	va_start(ap, fmt);	vError(stderr, fmt, ap);	va_end(ap);}static voidFatal(const char* fmt, ...){	va_list ap;	va_start(ap, fmt);	vError(stderr, fmt, ap);	va_end(ap);	exit(-1);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -