tool to fixes some issues in baseline tiffs (with extensions), see http://andreas-romeyke.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

103 lines
2.4 KiB

  1. #ifndef _FIXIT_TIFF
  2. #define _FIXIT_TIFF
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <unistd.h>
  7. #include <ctype.h>
  8. #include <tiffio.h>
  9. #include <tiff.h>
  10. /* define specific exit-codes */
  11. #define FIXIT_TIFF_IS_VALID 0
  12. #define FIXIT_TIFF_IS_CHECKED 1
  13. #define FIXIT_TIFF_IS_CORRECTED 1
  14. #define FIXIT_TIFF_IS_INVALID 3
  15. #define FIXIT_TIFF_MISSED_OUTFILE -1
  16. #define FIXIT_TIFF_MISSED_INFILE -2
  17. #define FIXIT_TIFF_CMDLINE_ARGUMENTS_ERROR -3
  18. #define FIXIT_TIFF_MEMORY_ALLOCATION_ERROR -4
  19. #define FIXIT_TIFF_DATETIME_RULE_NOT_FOUND -6
  20. #define FIXIT_TIFF_STRING_COPY_ERROR -5
  21. #define FIXIT_TIFF_READ_PERMISSION_ERROR -20
  22. #define FIXIT_TIFF_WRITE_PERMISSION_ERROR -21
  23. #define FIXIT_TIFF_WRITE_ERROR -22
  24. #define FIXIT_TIFF_READ_ERROR -23
  25. /** 20 comes from TIFF definition
  26. */
  27. #define TIFFDATETIMELENGTH 20
  28. int cleanup_datetime (const char *);
  29. int cleanup_icc_header (const char *);
  30. int cleanup_baseline (const char *);
  31. int cleanup_tagorder (const char *);
  32. int cleanup_tag (const char *, uint32);
  33. int cleanup_tagtype (const char *, uint32);
  34. #define FLAGGED 1
  35. #define UNFLAGGED 0
  36. static int flag_be_verbose;
  37. #define count_of_baselinetags 36
  38. const static uint32 baselinetags[count_of_baselinetags]={
  39. TIFFTAG_SUBFILETYPE,
  40. TIFFTAG_OSUBFILETYPE,
  41. TIFFTAG_IMAGEWIDTH,
  42. TIFFTAG_IMAGELENGTH,
  43. TIFFTAG_BITSPERSAMPLE,
  44. TIFFTAG_COMPRESSION,
  45. TIFFTAG_PHOTOMETRIC,
  46. TIFFTAG_THRESHHOLDING,
  47. TIFFTAG_CELLWIDTH,
  48. TIFFTAG_CELLLENGTH,
  49. TIFFTAG_FILLORDER,
  50. TIFFTAG_IMAGEDESCRIPTION,
  51. TIFFTAG_MAKE,
  52. TIFFTAG_MODEL,
  53. TIFFTAG_STRIPOFFSETS,
  54. TIFFTAG_ORIENTATION,
  55. TIFFTAG_SAMPLESPERPIXEL,
  56. TIFFTAG_ROWSPERSTRIP,
  57. TIFFTAG_STRIPBYTECOUNTS,
  58. TIFFTAG_MINSAMPLEVALUE,
  59. TIFFTAG_MAXSAMPLEVALUE,
  60. TIFFTAG_XRESOLUTION,
  61. TIFFTAG_YRESOLUTION,
  62. TIFFTAG_PLANARCONFIG,
  63. TIFFTAG_FREEOFFSETS,
  64. TIFFTAG_FREEBYTECOUNTS,
  65. TIFFTAG_GRAYRESPONSEUNIT,
  66. TIFFTAG_GRAYRESPONSECURVE,
  67. TIFFTAG_RESOLUTIONUNIT,
  68. TIFFTAG_SOFTWARE,
  69. TIFFTAG_DATETIME,
  70. TIFFTAG_ARTIST,
  71. TIFFTAG_HOSTCOMPUTER,
  72. TIFFTAG_COLORMAP,
  73. TIFFTAG_EXTRASAMPLES,
  74. TIFFTAG_COPYRIGHT
  75. };
  76. #define count_of_required_baselinetags 12
  77. const static uint32 required_baselinetags[count_of_required_baselinetags]={
  78. TIFFTAG_IMAGEWIDTH,
  79. TIFFTAG_IMAGELENGTH,
  80. TIFFTAG_COMPRESSION,
  81. TIFFTAG_PHOTOMETRIC,
  82. TIFFTAG_STRIPOFFSETS,
  83. TIFFTAG_SAMPLESPERPIXEL,
  84. TIFFTAG_ROWSPERSTRIP,
  85. TIFFTAG_STRIPBYTECOUNTS,
  86. TIFFTAG_XRESOLUTION,
  87. TIFFTAG_YRESOLUTION,
  88. TIFFTAG_RESOLUTIONUNIT,
  89. TIFFTAG_BITSPERSAMPLE
  90. };
  91. #endif
  92. /* _FIXIT_TIFF */