laag-libtiff 4.0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (629) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +57 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.org +34 -0
  5. data/ext/laag/libtiff/extconf.rb +13 -0
  6. data/laag-libtiff.gemspec +20 -0
  7. data/lib/laag/libtiff.rb +29 -0
  8. data/vendor/gitlab.com/libtiff/libtiff/.appveyor.yml +109 -0
  9. data/vendor/gitlab.com/libtiff/libtiff/.cvsignore +4 -0
  10. data/vendor/gitlab.com/libtiff/libtiff/.travis.yml +34 -0
  11. data/vendor/gitlab.com/libtiff/libtiff/CMakeLists.txt +764 -0
  12. data/vendor/gitlab.com/libtiff/libtiff/COMMITTERS +19 -0
  13. data/vendor/gitlab.com/libtiff/libtiff/COPYRIGHT +21 -0
  14. data/vendor/gitlab.com/libtiff/libtiff/ChangeLog +8073 -0
  15. data/vendor/gitlab.com/libtiff/libtiff/HOWTO-RELEASE +119 -0
  16. data/vendor/gitlab.com/libtiff/libtiff/HOWTO-SECURITY-RELEASE +19 -0
  17. data/vendor/gitlab.com/libtiff/libtiff/Makefile.am +91 -0
  18. data/vendor/gitlab.com/libtiff/libtiff/Makefile.in +995 -0
  19. data/vendor/gitlab.com/libtiff/libtiff/Makefile.vc +58 -0
  20. data/vendor/gitlab.com/libtiff/libtiff/README +61 -0
  21. data/vendor/gitlab.com/libtiff/libtiff/README.vms +12 -0
  22. data/vendor/gitlab.com/libtiff/libtiff/RELEASE-DATE +1 -0
  23. data/vendor/gitlab.com/libtiff/libtiff/SConstruct +171 -0
  24. data/vendor/gitlab.com/libtiff/libtiff/TODO +12 -0
  25. data/vendor/gitlab.com/libtiff/libtiff/VERSION +1 -0
  26. data/vendor/gitlab.com/libtiff/libtiff/aclocal.m4 +1194 -0
  27. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/bmp2tiff.1.html +121 -0
  28. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/gif2tiff.1.html +141 -0
  29. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/ras2tiff.1.html +139 -0
  30. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/sgi2tiff.1.html +147 -0
  31. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/tiffsv.1.html +207 -0
  32. data/vendor/gitlab.com/libtiff/libtiff/archive/man/bmp2tiff.1 +85 -0
  33. data/vendor/gitlab.com/libtiff/libtiff/archive/man/gif2tiff.1 +81 -0
  34. data/vendor/gitlab.com/libtiff/libtiff/archive/man/ras2tiff.1 +96 -0
  35. data/vendor/gitlab.com/libtiff/libtiff/archive/man/sgi2tiff.1 +93 -0
  36. data/vendor/gitlab.com/libtiff/libtiff/archive/man/tiffsv.1 +142 -0
  37. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/bmp2tiff.c +937 -0
  38. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/gif2tiff.c +591 -0
  39. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/ras2tiff.c +338 -0
  40. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/rasterfile.h +44 -0
  41. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/sgi2tiff.c +337 -0
  42. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/sgisv.c +318 -0
  43. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/ycbcr.c +168 -0
  44. data/vendor/gitlab.com/libtiff/libtiff/autogen.sh +8 -0
  45. data/vendor/gitlab.com/libtiff/libtiff/build/.cvsignore +1 -0
  46. data/vendor/gitlab.com/libtiff/libtiff/build/CMakeLists.txt +25 -0
  47. data/vendor/gitlab.com/libtiff/libtiff/build/Makefile.am +32 -0
  48. data/vendor/gitlab.com/libtiff/libtiff/build/Makefile.in +680 -0
  49. data/vendor/gitlab.com/libtiff/libtiff/build/README +3 -0
  50. data/vendor/gitlab.com/libtiff/libtiff/build/travis-ci +108 -0
  51. data/vendor/gitlab.com/libtiff/libtiff/commit +233 -0
  52. data/vendor/gitlab.com/libtiff/libtiff/config/compile +347 -0
  53. data/vendor/gitlab.com/libtiff/libtiff/config/config.guess +1526 -0
  54. data/vendor/gitlab.com/libtiff/libtiff/config/config.sub +1658 -0
  55. data/vendor/gitlab.com/libtiff/libtiff/config/depcomp +791 -0
  56. data/vendor/gitlab.com/libtiff/libtiff/config/install-sh +507 -0
  57. data/vendor/gitlab.com/libtiff/libtiff/config/ltmain.sh +11156 -0
  58. data/vendor/gitlab.com/libtiff/libtiff/config/missing +215 -0
  59. data/vendor/gitlab.com/libtiff/libtiff/config/mkinstalldirs +161 -0
  60. data/vendor/gitlab.com/libtiff/libtiff/config/test-driver +127 -0
  61. data/vendor/gitlab.com/libtiff/libtiff/configure +23612 -0
  62. data/vendor/gitlab.com/libtiff/libtiff/configure.ac +1112 -0
  63. data/vendor/gitlab.com/libtiff/libtiff/configure.com +1357 -0
  64. data/vendor/gitlab.com/libtiff/libtiff/contrib/.cvsignore +2 -0
  65. data/vendor/gitlab.com/libtiff/libtiff/contrib/CMakeLists.txt +35 -0
  66. data/vendor/gitlab.com/libtiff/libtiff/contrib/Makefile.am +31 -0
  67. data/vendor/gitlab.com/libtiff/libtiff/contrib/Makefile.in +679 -0
  68. data/vendor/gitlab.com/libtiff/libtiff/contrib/README +2 -0
  69. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/.cvsignore +5 -0
  70. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/CMakeLists.txt +34 -0
  71. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.am +39 -0
  72. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.in +652 -0
  73. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.vc +28 -0
  74. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/README +142 -0
  75. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/addtiffo.c +181 -0
  76. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_overview.c +916 -0
  77. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_ovrcache.c +344 -0
  78. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_ovrcache.h +103 -0
  79. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/.cvsignore +8 -0
  80. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/CMakeLists.txt +43 -0
  81. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/Makefile.am +46 -0
  82. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/Makefile.in +798 -0
  83. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/README +7 -0
  84. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-bi.c +91 -0
  85. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-grayscale.c +147 -0
  86. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-palette.c +284 -0
  87. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-rgb.c +201 -0
  88. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/.cvsignore +2 -0
  89. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/CMakeLists.txt +29 -0
  90. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/Makefile.am +47 -0
  91. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/Makefile.in +516 -0
  92. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/README +6 -0
  93. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/patchlevel.h +8 -0
  94. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/xtiff.c +1290 -0
  95. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/xtifficon.h +21 -0
  96. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/.cvsignore +5 -0
  97. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/CMakeLists.txt +35 -0
  98. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/Makefile.am +40 -0
  99. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/Makefile.in +650 -0
  100. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/README +25 -0
  101. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/iptcutil.c +954 -0
  102. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/test.iptc +0 -0
  103. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/test.txt +32 -0
  104. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/.cvsignore +2 -0
  105. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/CMakeLists.txt +27 -0
  106. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/Makefile.am +29 -0
  107. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/Makefile.in +499 -0
  108. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/README +37 -0
  109. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/mfs_file.c +586 -0
  110. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/.cvsignore +2 -0
  111. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/CMakeLists.txt +30 -0
  112. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/Makefile.am +32 -0
  113. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/Makefile.in +502 -0
  114. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/README +90 -0
  115. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_imageiter.c +525 -0
  116. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_imageiter.h +64 -0
  117. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_pdsdirread.c +1131 -0
  118. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_pdsdirwrite.c +971 -0
  119. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/.cvsignore +2 -0
  120. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/CMakeLists.txt +28 -0
  121. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/Makefile.am +30 -0
  122. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/Makefile.in +500 -0
  123. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/README +10 -0
  124. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/ras2tif.c +254 -0
  125. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/tif2ras.c +344 -0
  126. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/.cvsignore +2 -0
  127. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/CMakeLists.txt +28 -0
  128. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/Makefile.am +30 -0
  129. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/Makefile.in +500 -0
  130. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/README +30 -0
  131. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/tiffstream.cpp +238 -0
  132. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/tiffstream.h +70 -0
  133. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/.cvsignore +2 -0
  134. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/CMakeLists.txt +32 -0
  135. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/Makefile.am +33 -0
  136. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/Makefile.in +503 -0
  137. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/README +132 -0
  138. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/listtif.c +39 -0
  139. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/maketif.c +77 -0
  140. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtif_dir.c +350 -0
  141. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtiffio.h +59 -0
  142. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtiffiop.h +72 -0
  143. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/.cvsignore +2 -0
  144. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/CMakeLists.txt +30 -0
  145. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.am +32 -0
  146. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.in +502 -0
  147. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.w95 +134 -0
  148. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/README.Tiffile +31 -0
  149. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/README.tiff2dib +51 -0
  150. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Tiffile.cpp +449 -0
  151. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/tiff2dib.c +379 -0
  152. data/vendor/gitlab.com/libtiff/libtiff/html/.cvsignore +5 -0
  153. data/vendor/gitlab.com/libtiff/libtiff/html/BigTIFFProposal.html +99 -0
  154. data/vendor/gitlab.com/libtiff/libtiff/html/CMakeLists.txt +87 -0
  155. data/vendor/gitlab.com/libtiff/libtiff/html/Makefile.am +96 -0
  156. data/vendor/gitlab.com/libtiff/libtiff/html/Makefile.in +798 -0
  157. data/vendor/gitlab.com/libtiff/libtiff/html/TIFFTechNote2.html +707 -0
  158. data/vendor/gitlab.com/libtiff/libtiff/html/addingtags.html +292 -0
  159. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffdesign.html +80 -0
  160. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr.html +77 -0
  161. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/esri.png +0 -0
  162. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/leica.png +0 -0
  163. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/safe.png +0 -0
  164. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/weogeo.png +0 -0
  165. data/vendor/gitlab.com/libtiff/libtiff/html/bugs.html +61 -0
  166. data/vendor/gitlab.com/libtiff/libtiff/html/build.html +737 -0
  167. data/vendor/gitlab.com/libtiff/libtiff/html/contrib.html +209 -0
  168. data/vendor/gitlab.com/libtiff/libtiff/html/document.html +52 -0
  169. data/vendor/gitlab.com/libtiff/libtiff/html/images.html +41 -0
  170. data/vendor/gitlab.com/libtiff/libtiff/html/images/.cvsignore +2 -0
  171. data/vendor/gitlab.com/libtiff/libtiff/html/images/CMakeLists.txt +46 -0
  172. data/vendor/gitlab.com/libtiff/libtiff/html/images/Makefile.am +49 -0
  173. data/vendor/gitlab.com/libtiff/libtiff/html/images/Makefile.in +572 -0
  174. data/vendor/gitlab.com/libtiff/libtiff/html/images/back.gif +0 -0
  175. data/vendor/gitlab.com/libtiff/libtiff/html/images/bali.jpg +0 -0
  176. data/vendor/gitlab.com/libtiff/libtiff/html/images/cat.gif +0 -0
  177. data/vendor/gitlab.com/libtiff/libtiff/html/images/cover.jpg +0 -0
  178. data/vendor/gitlab.com/libtiff/libtiff/html/images/cramps.gif +0 -0
  179. data/vendor/gitlab.com/libtiff/libtiff/html/images/dave.gif +0 -0
  180. data/vendor/gitlab.com/libtiff/libtiff/html/images/info.gif +0 -0
  181. data/vendor/gitlab.com/libtiff/libtiff/html/images/jello.jpg +0 -0
  182. data/vendor/gitlab.com/libtiff/libtiff/html/images/jim.gif +0 -0
  183. data/vendor/gitlab.com/libtiff/libtiff/html/images/note.gif +0 -0
  184. data/vendor/gitlab.com/libtiff/libtiff/html/images/oxford.gif +0 -0
  185. data/vendor/gitlab.com/libtiff/libtiff/html/images/quad.jpg +0 -0
  186. data/vendor/gitlab.com/libtiff/libtiff/html/images/ring.gif +0 -0
  187. data/vendor/gitlab.com/libtiff/libtiff/html/images/smallliz.jpg +0 -0
  188. data/vendor/gitlab.com/libtiff/libtiff/html/images/strike.gif +0 -0
  189. data/vendor/gitlab.com/libtiff/libtiff/html/images/warning.gif +0 -0
  190. data/vendor/gitlab.com/libtiff/libtiff/html/index.html +122 -0
  191. data/vendor/gitlab.com/libtiff/libtiff/html/internals.html +572 -0
  192. data/vendor/gitlab.com/libtiff/libtiff/html/intro.html +68 -0
  193. data/vendor/gitlab.com/libtiff/libtiff/html/libtiff.html +747 -0
  194. data/vendor/gitlab.com/libtiff/libtiff/html/man/.cvsignore +2 -0
  195. data/vendor/gitlab.com/libtiff/libtiff/html/man/CMakeLists.txt +108 -0
  196. data/vendor/gitlab.com/libtiff/libtiff/html/man/HtmlDoc.cmake +50 -0
  197. data/vendor/gitlab.com/libtiff/libtiff/html/man/Makefile.am +122 -0
  198. data/vendor/gitlab.com/libtiff/libtiff/html/man/Makefile.in +642 -0
  199. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFClose.3tiff.html +87 -0
  200. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFDataWidth.3tiff.html +98 -0
  201. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFError.3tiff.html +106 -0
  202. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldDataType.3tiff.html +89 -0
  203. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldName.3tiff.html +86 -0
  204. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldPassCount.3tiff.html +98 -0
  205. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldReadCount.3tiff.html +101 -0
  206. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldTag.3tiff.html +88 -0
  207. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldWriteCount.3tiff.html +108 -0
  208. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFlush.3tiff.html +113 -0
  209. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFGetField.3tiff.html +1969 -0
  210. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFOpen.3tiff.html +421 -0
  211. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFPrintDirectory.3tiff.html +225 -0
  212. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFRGBAImage.3tiff.html +319 -0
  213. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadDirectory.3tiff.html +218 -0
  214. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadEncodedStrip.3tiff.html +133 -0
  215. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadEncodedTile.3tiff.html +130 -0
  216. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBAImage.3tiff.html +301 -0
  217. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBAStrip.3tiff.html +208 -0
  218. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBATile.3tiff.html +261 -0
  219. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRawStrip.3tiff.html +109 -0
  220. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRawTile.3tiff.html +111 -0
  221. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadScanline.3tiff.html +157 -0
  222. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadTile.3tiff.html +133 -0
  223. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFSetDirectory.3tiff.html +122 -0
  224. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFSetField.3tiff.html +1865 -0
  225. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWarning.3tiff.html +108 -0
  226. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteDirectory.3tiff.html +176 -0
  227. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteEncodedStrip.3tiff.html +153 -0
  228. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteEncodedTile.3tiff.html +147 -0
  229. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteRawStrip.3tiff.html +144 -0
  230. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteRawTile.3tiff.html +128 -0
  231. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteScanline.3tiff.html +206 -0
  232. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteTile.3tiff.html +115 -0
  233. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFbuffer.3tiff.html +116 -0
  234. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFcodec.3tiff.html +116 -0
  235. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFcolor.3tiff.html +975 -0
  236. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFmemory.3tiff.html +110 -0
  237. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFquery.3tiff.html +148 -0
  238. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFsize.3tiff.html +95 -0
  239. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFstrip.3tiff.html +129 -0
  240. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFswab.3tiff.html +110 -0
  241. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFtile.3tiff.html +141 -0
  242. data/vendor/gitlab.com/libtiff/libtiff/html/man/fax2ps.1.html +252 -0
  243. data/vendor/gitlab.com/libtiff/libtiff/html/man/fax2tiff.1.html +607 -0
  244. data/vendor/gitlab.com/libtiff/libtiff/html/man/index.html +64 -0
  245. data/vendor/gitlab.com/libtiff/libtiff/html/man/libtiff.3tiff.html +1150 -0
  246. data/vendor/gitlab.com/libtiff/libtiff/html/man/pal2rgb.1.html +189 -0
  247. data/vendor/gitlab.com/libtiff/libtiff/html/man/ppm2tiff.1.html +141 -0
  248. data/vendor/gitlab.com/libtiff/libtiff/html/man/raw2tiff.1.html +510 -0
  249. data/vendor/gitlab.com/libtiff/libtiff/html/man/rgb2ycbcr.1.html +155 -0
  250. data/vendor/gitlab.com/libtiff/libtiff/html/man/thumbnail.1.html +148 -0
  251. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2bw.1.html +161 -0
  252. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2pdf.1.html +609 -0
  253. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2ps.1.html +639 -0
  254. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2rgba.1.html +162 -0
  255. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcmp.1.html +156 -0
  256. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcp.1.html +569 -0
  257. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcrop.1.html +684 -0
  258. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffdither.1.html +196 -0
  259. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffdump.1.html +145 -0
  260. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffgt.1.html +551 -0
  261. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffinfo.1.html +196 -0
  262. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffmedian.1.html +183 -0
  263. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffset.1.html +176 -0
  264. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffsplit.1.html +102 -0
  265. data/vendor/gitlab.com/libtiff/libtiff/html/misc.html +117 -0
  266. data/vendor/gitlab.com/libtiff/libtiff/html/support.html +655 -0
  267. data/vendor/gitlab.com/libtiff/libtiff/html/tools.html +137 -0
  268. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta007.html +112 -0
  269. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta016.html +122 -0
  270. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta018.html +84 -0
  271. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta024.html +139 -0
  272. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta028.html +146 -0
  273. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta029.html +86 -0
  274. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta031.html +94 -0
  275. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta032.html +90 -0
  276. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta033.html +82 -0
  277. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta034.html +68 -0
  278. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta035.html +63 -0
  279. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta036.html +117 -0
  280. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.1.html +75 -0
  281. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.2.html +108 -0
  282. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.3.html +132 -0
  283. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.4.html +88 -0
  284. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.5.html +155 -0
  285. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.6-beta.html +185 -0
  286. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.7.html +259 -0
  287. data/vendor/gitlab.com/libtiff/libtiff/html/v3.6.0.html +434 -0
  288. data/vendor/gitlab.com/libtiff/libtiff/html/v3.6.1.html +199 -0
  289. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0.html +144 -0
  290. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0alpha.html +249 -0
  291. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0beta.html +162 -0
  292. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0beta2.html +131 -0
  293. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.1.html +233 -0
  294. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.2.html +222 -0
  295. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.3.html +230 -0
  296. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.4.html +133 -0
  297. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.0.html +199 -0
  298. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.1.html +217 -0
  299. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.2.html +137 -0
  300. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.0.html +261 -0
  301. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.0beta.html +304 -0
  302. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.1.html +115 -0
  303. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.2.html +122 -0
  304. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.3.html +160 -0
  305. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.4.html +125 -0
  306. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.5.html +270 -0
  307. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.0.html +269 -0
  308. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.1.html +113 -0
  309. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.2.html +118 -0
  310. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.3.html +125 -0
  311. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.4.html +274 -0
  312. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.4beta.html +291 -0
  313. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.5.html +148 -0
  314. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.6.html +139 -0
  315. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.7.html +411 -0
  316. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.8.html +445 -0
  317. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.9.html +373 -0
  318. data/vendor/gitlab.com/libtiff/libtiff/libtiff-4.pc.in +11 -0
  319. data/vendor/gitlab.com/libtiff/libtiff/libtiff/.cvsignore +22 -0
  320. data/vendor/gitlab.com/libtiff/libtiff/libtiff/CMakeLists.txt +165 -0
  321. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.am +154 -0
  322. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.in +966 -0
  323. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.lcc +129 -0
  324. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.vc +102 -0
  325. data/vendor/gitlab.com/libtiff/libtiff/libtiff/SConstruct +73 -0
  326. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiff.def +168 -0
  327. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiff.map +4 -0
  328. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiffxx.map +4 -0
  329. data/vendor/gitlab.com/libtiff/libtiff/libtiff/mkg3states.c +454 -0
  330. data/vendor/gitlab.com/libtiff/libtiff/libtiff/mkspans.c +82 -0
  331. data/vendor/gitlab.com/libtiff/libtiff/libtiff/t4.h +292 -0
  332. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_aux.c +376 -0
  333. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_close.c +140 -0
  334. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_codec.c +165 -0
  335. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_color.c +309 -0
  336. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_compress.c +304 -0
  337. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h-vms +46 -0
  338. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h.cmake.in +261 -0
  339. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h.in +410 -0
  340. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.vc.h +137 -0
  341. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.wince.h +71 -0
  342. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dir.c +1767 -0
  343. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dir.h +309 -0
  344. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirinfo.c +1070 -0
  345. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirread.c +5803 -0
  346. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirwrite.c +3024 -0
  347. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dumpmode.c +143 -0
  348. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_error.c +88 -0
  349. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_extension.c +118 -0
  350. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3.c +1648 -0
  351. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3.h +540 -0
  352. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3sm.c +1260 -0
  353. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_flush.c +118 -0
  354. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_getimage.c +3048 -0
  355. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jbig.c +214 -0
  356. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jpeg.c +2601 -0
  357. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jpeg_12.c +69 -0
  358. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_luv.c +1765 -0
  359. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_lzma.c +495 -0
  360. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_lzw.c +1218 -0
  361. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_next.c +189 -0
  362. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_ojpeg.c +2563 -0
  363. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_open.c +725 -0
  364. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_packbits.c +311 -0
  365. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_pixarlog.c +1485 -0
  366. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_predict.c +881 -0
  367. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_predict.h +79 -0
  368. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_print.c +722 -0
  369. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_read.c +1572 -0
  370. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_stream.cxx +430 -0
  371. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_strip.c +389 -0
  372. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_swab.c +312 -0
  373. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_thunder.c +208 -0
  374. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_tile.c +322 -0
  375. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_unix.c +386 -0
  376. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_version.c +40 -0
  377. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_vms.c +611 -0
  378. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_warning.c +89 -0
  379. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_win32.c +476 -0
  380. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_wince.c +293 -0
  381. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_write.c +834 -0
  382. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_zip.c +476 -0
  383. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiff.h +681 -0
  384. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h-vms +99 -0
  385. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h.cmake.in +130 -0
  386. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h.in +127 -0
  387. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.vc.h +161 -0
  388. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.wince.h +121 -0
  389. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffio.h +560 -0
  390. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffio.hxx +49 -0
  391. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffiop.h +445 -0
  392. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffvers.h +9 -0
  393. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffvers.h.in +9 -0
  394. data/vendor/gitlab.com/libtiff/libtiff/libtiff/uvcode.h +180 -0
  395. data/vendor/gitlab.com/libtiff/libtiff/m4/acinclude.m4 +851 -0
  396. data/vendor/gitlab.com/libtiff/libtiff/m4/ice_find_athena.m4 +187 -0
  397. data/vendor/gitlab.com/libtiff/libtiff/m4/libtool.m4 +8388 -0
  398. data/vendor/gitlab.com/libtiff/libtiff/m4/ltoptions.m4 +437 -0
  399. data/vendor/gitlab.com/libtiff/libtiff/m4/ltsugar.m4 +124 -0
  400. data/vendor/gitlab.com/libtiff/libtiff/m4/ltversion.m4 +23 -0
  401. data/vendor/gitlab.com/libtiff/libtiff/m4/lt~obsolete.m4 +99 -0
  402. data/vendor/gitlab.com/libtiff/libtiff/man/.cvsignore +3 -0
  403. data/vendor/gitlab.com/libtiff/libtiff/man/CMakeLists.txt +97 -0
  404. data/vendor/gitlab.com/libtiff/libtiff/man/Makefile.am +94 -0
  405. data/vendor/gitlab.com/libtiff/libtiff/man/Makefile.in +684 -0
  406. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFClose.3tiff +53 -0
  407. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFDataWidth.3tiff +74 -0
  408. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFError.3tiff +69 -0
  409. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldDataType.3tiff +53 -0
  410. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldName.3tiff +52 -0
  411. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldPassCount.3tiff +73 -0
  412. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldReadCount.3tiff +77 -0
  413. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldTag.3tiff +56 -0
  414. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldWriteCount.3tiff +88 -0
  415. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFlush.3tiff +64 -0
  416. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFGetField.3tiff +229 -0
  417. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFOpen.3tiff +279 -0
  418. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFPrintDirectory.3tiff +70 -0
  419. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFRGBAImage.3tiff +286 -0
  420. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadDirectory.3tiff +164 -0
  421. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadEncodedStrip.3tiff +78 -0
  422. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadEncodedTile.3tiff +76 -0
  423. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBAImage.3tiff +218 -0
  424. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBAStrip.3tiff +170 -0
  425. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBATile.3tiff +171 -0
  426. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRawStrip.3tiff +64 -0
  427. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRawTile.3tiff +65 -0
  428. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadScanline.3tiff +94 -0
  429. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadTile.3tiff +84 -0
  430. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFSetDirectory.3tiff +79 -0
  431. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFSetField.3tiff +217 -0
  432. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWarning.3tiff +70 -0
  433. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteDirectory.3tiff +138 -0
  434. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteEncodedStrip.3tiff +102 -0
  435. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteEncodedTile.3tiff +96 -0
  436. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteRawStrip.3tiff +96 -0
  437. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteRawTile.3tiff +84 -0
  438. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteScanline.3tiff +154 -0
  439. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteTile.3tiff +77 -0
  440. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFbuffer.3tiff +77 -0
  441. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFcodec.3tiff +82 -0
  442. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFcolor.3tiff +268 -0
  443. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFmemory.3tiff +90 -0
  444. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFquery.3tiff +142 -0
  445. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFsize.3tiff +59 -0
  446. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFstrip.3tiff +99 -0
  447. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFswab.3tiff +80 -0
  448. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFtile.3tiff +131 -0
  449. data/vendor/gitlab.com/libtiff/libtiff/man/fax2ps.1 +159 -0
  450. data/vendor/gitlab.com/libtiff/libtiff/man/fax2tiff.1 +286 -0
  451. data/vendor/gitlab.com/libtiff/libtiff/man/libtiff.3tiff +545 -0
  452. data/vendor/gitlab.com/libtiff/libtiff/man/pal2rgb.1 +111 -0
  453. data/vendor/gitlab.com/libtiff/libtiff/man/ppm2tiff.1 +105 -0
  454. data/vendor/gitlab.com/libtiff/libtiff/man/raw2tiff.1 +196 -0
  455. data/vendor/gitlab.com/libtiff/libtiff/man/rgb2ycbcr.1 +99 -0
  456. data/vendor/gitlab.com/libtiff/libtiff/man/thumbnail.1 +90 -0
  457. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2bw.1 +94 -0
  458. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2pdf.1 +254 -0
  459. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2ps.1 +294 -0
  460. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2rgba.1 +97 -0
  461. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcmp.1 +87 -0
  462. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcp.1 +317 -0
  463. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcrop.1 +571 -0
  464. data/vendor/gitlab.com/libtiff/libtiff/man/tiffdither.1 +135 -0
  465. data/vendor/gitlab.com/libtiff/libtiff/man/tiffdump.1 +81 -0
  466. data/vendor/gitlab.com/libtiff/libtiff/man/tiffgt.1 +245 -0
  467. data/vendor/gitlab.com/libtiff/libtiff/man/tiffinfo.1 +88 -0
  468. data/vendor/gitlab.com/libtiff/libtiff/man/tiffmedian.1 +112 -0
  469. data/vendor/gitlab.com/libtiff/libtiff/man/tiffset.1 +99 -0
  470. data/vendor/gitlab.com/libtiff/libtiff/man/tiffsplit.1 +69 -0
  471. data/vendor/gitlab.com/libtiff/libtiff/nmake.opt +229 -0
  472. data/vendor/gitlab.com/libtiff/libtiff/port/.cvsignore +7 -0
  473. data/vendor/gitlab.com/libtiff/libtiff/port/CMakeLists.txt +60 -0
  474. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.am +35 -0
  475. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.in +656 -0
  476. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.vc +44 -0
  477. data/vendor/gitlab.com/libtiff/libtiff/port/dummy.c +12 -0
  478. data/vendor/gitlab.com/libtiff/libtiff/port/getopt.c +125 -0
  479. data/vendor/gitlab.com/libtiff/libtiff/port/lfind.c +62 -0
  480. data/vendor/gitlab.com/libtiff/libtiff/port/libport.h +60 -0
  481. data/vendor/gitlab.com/libtiff/libtiff/port/snprintf.c +38 -0
  482. data/vendor/gitlab.com/libtiff/libtiff/port/strcasecmp.c +51 -0
  483. data/vendor/gitlab.com/libtiff/libtiff/port/strtoul.c +109 -0
  484. data/vendor/gitlab.com/libtiff/libtiff/port/strtoull.c +116 -0
  485. data/vendor/gitlab.com/libtiff/libtiff/test/.cvsignore +12 -0
  486. data/vendor/gitlab.com/libtiff/libtiff/test/CMakeLists.txt +382 -0
  487. data/vendor/gitlab.com/libtiff/libtiff/test/Makefile.am +334 -0
  488. data/vendor/gitlab.com/libtiff/libtiff/test/Makefile.in +1987 -0
  489. data/vendor/gitlab.com/libtiff/libtiff/test/TiffSplitTest.cmake +34 -0
  490. data/vendor/gitlab.com/libtiff/libtiff/test/TiffTest.cmake +63 -0
  491. data/vendor/gitlab.com/libtiff/libtiff/test/TiffTestCommon.cmake +108 -0
  492. data/vendor/gitlab.com/libtiff/libtiff/test/ascii_tag.c +177 -0
  493. data/vendor/gitlab.com/libtiff/libtiff/test/check_tag.c +91 -0
  494. data/vendor/gitlab.com/libtiff/libtiff/test/common.sh +122 -0
  495. data/vendor/gitlab.com/libtiff/libtiff/test/custom_dir.c +247 -0
  496. data/vendor/gitlab.com/libtiff/libtiff/test/images/README.txt +29 -0
  497. data/vendor/gitlab.com/libtiff/libtiff/test/images/logluv-3c-16b.tiff +0 -0
  498. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-16b.tiff +0 -0
  499. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-8b.pgm +0 -0
  500. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-8b.tiff +0 -0
  501. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-2c-8b-alpha.tiff +0 -0
  502. data/vendor/gitlab.com/libtiff/libtiff/test/images/miniswhite-1c-1b.pbm +0 -0
  503. data/vendor/gitlab.com/libtiff/libtiff/test/images/miniswhite-1c-1b.tiff +0 -0
  504. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-1b.tiff +0 -0
  505. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-4b.tiff +0 -0
  506. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-8b.tiff +0 -0
  507. data/vendor/gitlab.com/libtiff/libtiff/test/images/quad-lzw-compat.tiff +0 -0
  508. data/vendor/gitlab.com/libtiff/libtiff/test/images/quad-tile.jpg.tiff +0 -0
  509. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-16b.tiff +0 -0
  510. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-8b.ppm +0 -0
  511. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-8b.tiff +0 -0
  512. data/vendor/gitlab.com/libtiff/libtiff/test/long_tag.c +156 -0
  513. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_pbm.sh +7 -0
  514. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_pgm.sh +7 -0
  515. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_ppm.sh +7 -0
  516. data/vendor/gitlab.com/libtiff/libtiff/test/raw_decode.c +304 -0
  517. data/vendor/gitlab.com/libtiff/libtiff/test/rewrite_tag.c +344 -0
  518. data/vendor/gitlab.com/libtiff/libtiff/test/short_tag.c +205 -0
  519. data/vendor/gitlab.com/libtiff/libtiff/test/strip.c +290 -0
  520. data/vendor/gitlab.com/libtiff/libtiff/test/strip_rw.c +157 -0
  521. data/vendor/gitlab.com/libtiff/libtiff/test/test_arrays.c +829 -0
  522. data/vendor/gitlab.com/libtiff/libtiff/test/test_arrays.h +63 -0
  523. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-palette-1c-8b.sh +7 -0
  524. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-quad-lzw-compat.sh +7 -0
  525. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-rgb-3c-8b.sh +7 -0
  526. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2pdf.sh +6 -0
  527. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-EPS1.sh +6 -0
  528. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS1.sh +6 -0
  529. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS2.sh +6 -0
  530. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS3.sh +6 -0
  531. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-logluv-3c-16b.sh +7 -0
  532. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-1c-16b.sh +7 -0
  533. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-1c-8b.sh +7 -0
  534. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-2c-8b-alpha.sh +7 -0
  535. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-miniswhite-1c-1b.sh +7 -0
  536. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-1b.sh +7 -0
  537. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-4b.sh +7 -0
  538. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-8b.sh +7 -0
  539. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-quad-tile.jpg.sh +7 -0
  540. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-rgb-3c-16b.sh +7 -0
  541. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-rgb-3c-8b.sh +7 -0
  542. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-1d-fill.sh +7 -0
  543. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-1d.sh +6 -0
  544. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-2d-fill.sh +7 -0
  545. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-2d.sh +6 -0
  546. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3.sh +6 -0
  547. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g4.sh +6 -0
  548. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-logluv.sh +7 -0
  549. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-lzw-compat.sh +6 -0
  550. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-split-join.sh +16 -0
  551. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-split.sh +13 -0
  552. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-thumbnail.sh +10 -0
  553. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-logluv-3c-16b.sh +7 -0
  554. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-1c-16b.sh +7 -0
  555. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-1c-8b.sh +7 -0
  556. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-2c-8b-alpha.sh +7 -0
  557. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-miniswhite-1c-1b.sh +7 -0
  558. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-1b.sh +7 -0
  559. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-4b.sh +7 -0
  560. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-8b.sh +7 -0
  561. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-quad-tile.jpg.sh +7 -0
  562. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-rgb-3c-16b.sh +7 -0
  563. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-rgb-3c-8b.sh +7 -0
  564. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-logluv-3c-16b.sh +7 -0
  565. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-1c-16b.sh +7 -0
  566. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-1c-8b.sh +7 -0
  567. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-2c-8b-alpha.sh +7 -0
  568. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-miniswhite-1c-1b.sh +7 -0
  569. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-1b.sh +7 -0
  570. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-4b.sh +7 -0
  571. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-8b.sh +7 -0
  572. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-quad-tile.jpg.sh +7 -0
  573. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-rgb-3c-16b.sh +7 -0
  574. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-rgb-3c-8b.sh +7 -0
  575. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-logluv-3c-16b.sh +7 -0
  576. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-1c-16b.sh +7 -0
  577. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-1c-8b.sh +7 -0
  578. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-2c-8b-alpha.sh +7 -0
  579. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-miniswhite-1c-1b.sh +7 -0
  580. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-1b.sh +7 -0
  581. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-4b.sh +7 -0
  582. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-8b.sh +7 -0
  583. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-quad-tile.jpg.sh +7 -0
  584. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-rgb-3c-16b.sh +7 -0
  585. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-rgb-3c-8b.sh +7 -0
  586. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-logluv-3c-16b.sh +7 -0
  587. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-1c-16b.sh +7 -0
  588. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-1c-8b.sh +7 -0
  589. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-2c-8b-alpha.sh +7 -0
  590. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-miniswhite-1c-1b.sh +7 -0
  591. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-1b.sh +7 -0
  592. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-4b.sh +7 -0
  593. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-8b.sh +7 -0
  594. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-quad-tile.jpg.sh +7 -0
  595. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-rgb-3c-16b.sh +7 -0
  596. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-rgb-3c-8b.sh +7 -0
  597. data/vendor/gitlab.com/libtiff/libtiff/test/tiffdump.sh +6 -0
  598. data/vendor/gitlab.com/libtiff/libtiff/test/tiffinfo.sh +6 -0
  599. data/vendor/gitlab.com/libtiff/libtiff/test/tifftest.h +42 -0
  600. data/vendor/gitlab.com/libtiff/libtiff/tiff.spec +68 -0
  601. data/vendor/gitlab.com/libtiff/libtiff/tools/.cvsignore +27 -0
  602. data/vendor/gitlab.com/libtiff/libtiff/tools/CMakeLists.txt +125 -0
  603. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.am +138 -0
  604. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.in +955 -0
  605. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.lcc +133 -0
  606. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.vc +52 -0
  607. data/vendor/gitlab.com/libtiff/libtiff/tools/fax2ps.c +463 -0
  608. data/vendor/gitlab.com/libtiff/libtiff/tools/fax2tiff.c +491 -0
  609. data/vendor/gitlab.com/libtiff/libtiff/tools/pal2rgb.c +438 -0
  610. data/vendor/gitlab.com/libtiff/libtiff/tools/ppm2tiff.c +397 -0
  611. data/vendor/gitlab.com/libtiff/libtiff/tools/raw2tiff.c +690 -0
  612. data/vendor/gitlab.com/libtiff/libtiff/tools/rgb2ycbcr.c +397 -0
  613. data/vendor/gitlab.com/libtiff/libtiff/tools/thumbnail.c +691 -0
  614. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2bw.c +501 -0
  615. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2pdf.c +5594 -0
  616. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2ps.c +3106 -0
  617. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2rgba.c +569 -0
  618. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcmp.c +659 -0
  619. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcp.c +1913 -0
  620. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcrop.c +9231 -0
  621. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffdither.c +347 -0
  622. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffdump.c +889 -0
  623. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffgt.c +486 -0
  624. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffinfo.c +488 -0
  625. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffinfoce.c +472 -0
  626. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffmedian.c +918 -0
  627. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffset.c +356 -0
  628. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffsplit.c +305 -0
  629. metadata +692 -0
@@ -0,0 +1,1913 @@
1
+ /* $Id: tiffcp.c,v 1.61 2017-01-11 19:26:14 erouault Exp $ */
2
+
3
+ /*
4
+ * Copyright (c) 1988-1997 Sam Leffler
5
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
6
+ *
7
+ * Revised: 2/18/01 BAR -- added syntax for extracting single images from
8
+ * multi-image TIFF files.
9
+ *
10
+ * New syntax is: sourceFileName,image#
11
+ *
12
+ * image# ranges from 0..<n-1> where n is the # of images in the file.
13
+ * There may be no white space between the comma and the filename or
14
+ * image number.
15
+ *
16
+ * Example: tiffcp source.tif,1 destination.tif
17
+ *
18
+ * Copies the 2nd image in source.tif to the destination.
19
+ *
20
+ *****
21
+ * Permission to use, copy, modify, distribute, and sell this software and
22
+ * its documentation for any purpose is hereby granted without fee, provided
23
+ * that (i) the above copyright notices and this permission notice appear in
24
+ * all copies of the software and related documentation, and (ii) the names of
25
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
26
+ * publicity relating to the software without the specific, prior written
27
+ * permission of Sam Leffler and Silicon Graphics.
28
+ *
29
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
30
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
31
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
32
+ *
33
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
34
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
35
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
36
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
37
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
38
+ * OF THIS SOFTWARE.
39
+ */
40
+
41
+ #include "tif_config.h"
42
+
43
+ #include <stdio.h>
44
+ #include <stdlib.h>
45
+ #include <string.h>
46
+
47
+ #include <ctype.h>
48
+
49
+ #ifdef HAVE_UNISTD_H
50
+ # include <unistd.h>
51
+ #endif
52
+
53
+ #include "tiffio.h"
54
+
55
+ #ifndef HAVE_GETOPT
56
+ extern int getopt(int, char**, char*);
57
+ #endif
58
+
59
+ #if defined(VMS)
60
+ # define unlink delete
61
+ #endif
62
+
63
+ #define streq(a,b) (strcmp(a,b) == 0)
64
+ #define strneq(a,b,n) (strncmp(a,b,n) == 0)
65
+
66
+ #define TRUE 1
67
+ #define FALSE 0
68
+
69
+ static int outtiled = -1;
70
+ static uint32 tilewidth;
71
+ static uint32 tilelength;
72
+
73
+ static uint16 config;
74
+ static uint16 compression;
75
+ static uint16 predictor;
76
+ static int preset;
77
+ static uint16 fillorder;
78
+ static uint16 orientation;
79
+ static uint32 rowsperstrip;
80
+ static uint32 g3opts;
81
+ static int ignore = FALSE; /* if true, ignore read errors */
82
+ static uint32 defg3opts = (uint32) -1;
83
+ static int quality = 75; /* JPEG quality */
84
+ static int jpegcolormode = JPEGCOLORMODE_RGB;
85
+ static uint16 defcompression = (uint16) -1;
86
+ static uint16 defpredictor = (uint16) -1;
87
+ static int defpreset = -1;
88
+
89
+ static int tiffcp(TIFF*, TIFF*);
90
+ static int processCompressOptions(char*);
91
+ static void usage(void);
92
+
93
+ static char comma = ','; /* (default) comma separator character */
94
+ static TIFF* bias = NULL;
95
+ static int pageNum = 0;
96
+ static int pageInSeq = 0;
97
+
98
+ static int nextSrcImage (TIFF *tif, char **imageSpec)
99
+ /*
100
+ seek to the next image specified in *imageSpec
101
+ returns 1 if success, 0 if no more images to process
102
+ *imageSpec=NULL if subsequent images should be processed in sequence
103
+ */
104
+ {
105
+ if (**imageSpec == comma) { /* if not @comma, we've done all images */
106
+ char *start = *imageSpec + 1;
107
+ tdir_t nextImage = (tdir_t)strtol(start, imageSpec, 0);
108
+ if (start == *imageSpec) nextImage = TIFFCurrentDirectory (tif);
109
+ if (**imageSpec)
110
+ {
111
+ if (**imageSpec == comma) {
112
+ /* a trailing comma denotes remaining images in sequence */
113
+ if ((*imageSpec)[1] == '\0') *imageSpec = NULL;
114
+ }else{
115
+ fprintf (stderr,
116
+ "Expected a %c separated image # list after %s\n",
117
+ comma, TIFFFileName (tif));
118
+ exit (-4); /* syntax error */
119
+ }
120
+ }
121
+ if (TIFFSetDirectory (tif, nextImage)) return 1;
122
+ fprintf (stderr, "%s%c%d not found!\n",
123
+ TIFFFileName(tif), comma, (int) nextImage);
124
+ }
125
+ return 0;
126
+ }
127
+
128
+
129
+ static TIFF* openSrcImage (char **imageSpec)
130
+ /*
131
+ imageSpec points to a pointer to a filename followed by optional ,image#'s
132
+ Open the TIFF file and assign *imageSpec to either NULL if there are
133
+ no images specified, or a pointer to the next image number text
134
+ */
135
+ {
136
+ TIFF *tif;
137
+ char *fn = *imageSpec;
138
+ *imageSpec = strchr (fn, comma);
139
+ if (*imageSpec) { /* there is at least one image number specifier */
140
+ **imageSpec = '\0';
141
+ tif = TIFFOpen (fn, "r");
142
+ /* but, ignore any single trailing comma */
143
+ if (!(*imageSpec)[1]) {*imageSpec = NULL; return tif;}
144
+ if (tif) {
145
+ **imageSpec = comma; /* replace the comma */
146
+ if (!nextSrcImage(tif, imageSpec)) {
147
+ TIFFClose (tif);
148
+ tif = NULL;
149
+ }
150
+ }
151
+ }else
152
+ tif = TIFFOpen (fn, "r");
153
+ return tif;
154
+ }
155
+
156
+ int
157
+ main(int argc, char* argv[])
158
+ {
159
+ uint16 defconfig = (uint16) -1;
160
+ uint16 deffillorder = 0;
161
+ uint32 deftilewidth = (uint32) -1;
162
+ uint32 deftilelength = (uint32) -1;
163
+ uint32 defrowsperstrip = (uint32) 0;
164
+ uint64 diroff = 0;
165
+ TIFF* in;
166
+ TIFF* out;
167
+ char mode[10];
168
+ char* mp = mode;
169
+ int c;
170
+ #if !HAVE_DECL_OPTARG
171
+ extern int optind;
172
+ extern char* optarg;
173
+ #endif
174
+
175
+ *mp++ = 'w';
176
+ *mp = '\0';
177
+ while ((c = getopt(argc, argv, ",:b:c:f:l:o:p:r:w:aistBLMC8x")) != -1)
178
+ switch (c) {
179
+ case ',':
180
+ if (optarg[0] != '=') usage();
181
+ comma = optarg[1];
182
+ break;
183
+ case 'b': /* this file is bias image subtracted from others */
184
+ if (bias) {
185
+ fputs ("Only 1 bias image may be specified\n", stderr);
186
+ exit (-2);
187
+ }
188
+ {
189
+ uint16 samples = (uint16) -1;
190
+ char **biasFn = &optarg;
191
+ bias = openSrcImage (biasFn);
192
+ if (!bias) exit (-5);
193
+ if (TIFFIsTiled (bias)) {
194
+ fputs ("Bias image must be organized in strips\n", stderr);
195
+ exit (-7);
196
+ }
197
+ TIFFGetField(bias, TIFFTAG_SAMPLESPERPIXEL, &samples);
198
+ if (samples != 1) {
199
+ fputs ("Bias image must be monochrome\n", stderr);
200
+ exit (-7);
201
+ }
202
+ }
203
+ break;
204
+ case 'a': /* append to output */
205
+ mode[0] = 'a';
206
+ break;
207
+ case 'c': /* compression scheme */
208
+ if (!processCompressOptions(optarg))
209
+ usage();
210
+ break;
211
+ case 'f': /* fill order */
212
+ if (streq(optarg, "lsb2msb"))
213
+ deffillorder = FILLORDER_LSB2MSB;
214
+ else if (streq(optarg, "msb2lsb"))
215
+ deffillorder = FILLORDER_MSB2LSB;
216
+ else
217
+ usage();
218
+ break;
219
+ case 'i': /* ignore errors */
220
+ ignore = TRUE;
221
+ break;
222
+ case 'l': /* tile length */
223
+ outtiled = TRUE;
224
+ deftilelength = atoi(optarg);
225
+ break;
226
+ case 'o': /* initial directory offset */
227
+ diroff = strtoul(optarg, NULL, 0);
228
+ break;
229
+ case 'p': /* planar configuration */
230
+ if (streq(optarg, "separate"))
231
+ defconfig = PLANARCONFIG_SEPARATE;
232
+ else if (streq(optarg, "contig"))
233
+ defconfig = PLANARCONFIG_CONTIG;
234
+ else
235
+ usage();
236
+ break;
237
+ case 'r': /* rows/strip */
238
+ defrowsperstrip = atol(optarg);
239
+ break;
240
+ case 's': /* generate stripped output */
241
+ outtiled = FALSE;
242
+ break;
243
+ case 't': /* generate tiled output */
244
+ outtiled = TRUE;
245
+ break;
246
+ case 'w': /* tile width */
247
+ outtiled = TRUE;
248
+ deftilewidth = atoi(optarg);
249
+ break;
250
+ case 'B':
251
+ *mp++ = 'b'; *mp = '\0';
252
+ break;
253
+ case 'L':
254
+ *mp++ = 'l'; *mp = '\0';
255
+ break;
256
+ case 'M':
257
+ *mp++ = 'm'; *mp = '\0';
258
+ break;
259
+ case 'C':
260
+ *mp++ = 'c'; *mp = '\0';
261
+ break;
262
+ case '8':
263
+ *mp++ = '8'; *mp = '\0';
264
+ break;
265
+ case 'x':
266
+ pageInSeq = 1;
267
+ break;
268
+ case '?':
269
+ usage();
270
+ /*NOTREACHED*/
271
+ }
272
+ if (argc - optind < 2)
273
+ usage();
274
+ out = TIFFOpen(argv[argc-1], mode);
275
+ if (out == NULL)
276
+ return (-2);
277
+ if ((argc - optind) == 2)
278
+ pageNum = -1;
279
+ for (; optind < argc-1 ; optind++) {
280
+ char *imageCursor = argv[optind];
281
+ in = openSrcImage (&imageCursor);
282
+ if (in == NULL) {
283
+ (void) TIFFClose(out);
284
+ return (-3);
285
+ }
286
+ if (diroff != 0 && !TIFFSetSubDirectory(in, diroff)) {
287
+ TIFFError(TIFFFileName(in),
288
+ "Error, setting subdirectory at " TIFF_UINT64_FORMAT, diroff);
289
+ (void) TIFFClose(in);
290
+ (void) TIFFClose(out);
291
+ return (1);
292
+ }
293
+ for (;;) {
294
+ config = defconfig;
295
+ compression = defcompression;
296
+ predictor = defpredictor;
297
+ preset = defpreset;
298
+ fillorder = deffillorder;
299
+ rowsperstrip = defrowsperstrip;
300
+ tilewidth = deftilewidth;
301
+ tilelength = deftilelength;
302
+ g3opts = defg3opts;
303
+ if (!tiffcp(in, out) || !TIFFWriteDirectory(out)) {
304
+ (void) TIFFClose(in);
305
+ (void) TIFFClose(out);
306
+ return (1);
307
+ }
308
+ if (imageCursor) { /* seek next image directory */
309
+ if (!nextSrcImage(in, &imageCursor)) break;
310
+ }else
311
+ if (!TIFFReadDirectory(in)) break;
312
+ }
313
+ (void) TIFFClose(in);
314
+ }
315
+
316
+ (void) TIFFClose(out);
317
+ return (0);
318
+ }
319
+
320
+ static void
321
+ processZIPOptions(char* cp)
322
+ {
323
+ if ( (cp = strchr(cp, ':')) ) {
324
+ do {
325
+ cp++;
326
+ if (isdigit((int)*cp))
327
+ defpredictor = atoi(cp);
328
+ else if (*cp == 'p')
329
+ defpreset = atoi(++cp);
330
+ else
331
+ usage();
332
+ } while( (cp = strchr(cp, ':')) );
333
+ }
334
+ }
335
+
336
+ static void
337
+ processG3Options(char* cp)
338
+ {
339
+ if( (cp = strchr(cp, ':')) ) {
340
+ if (defg3opts == (uint32) -1)
341
+ defg3opts = 0;
342
+ do {
343
+ cp++;
344
+ if (strneq(cp, "1d", 2))
345
+ defg3opts &= ~GROUP3OPT_2DENCODING;
346
+ else if (strneq(cp, "2d", 2))
347
+ defg3opts |= GROUP3OPT_2DENCODING;
348
+ else if (strneq(cp, "fill", 4))
349
+ defg3opts |= GROUP3OPT_FILLBITS;
350
+ else
351
+ usage();
352
+ } while( (cp = strchr(cp, ':')) );
353
+ }
354
+ }
355
+
356
+ static int
357
+ processCompressOptions(char* opt)
358
+ {
359
+ if (streq(opt, "none")) {
360
+ defcompression = COMPRESSION_NONE;
361
+ } else if (streq(opt, "packbits")) {
362
+ defcompression = COMPRESSION_PACKBITS;
363
+ } else if (strneq(opt, "jpeg", 4)) {
364
+ char* cp = strchr(opt, ':');
365
+
366
+ defcompression = COMPRESSION_JPEG;
367
+ while( cp )
368
+ {
369
+ if (isdigit((int)cp[1]))
370
+ quality = atoi(cp+1);
371
+ else if (cp[1] == 'r' )
372
+ jpegcolormode = JPEGCOLORMODE_RAW;
373
+ else
374
+ usage();
375
+
376
+ cp = strchr(cp+1,':');
377
+ }
378
+ } else if (strneq(opt, "g3", 2)) {
379
+ processG3Options(opt);
380
+ defcompression = COMPRESSION_CCITTFAX3;
381
+ } else if (streq(opt, "g4")) {
382
+ defcompression = COMPRESSION_CCITTFAX4;
383
+ } else if (strneq(opt, "lzw", 3)) {
384
+ char* cp = strchr(opt, ':');
385
+ if (cp)
386
+ defpredictor = atoi(cp+1);
387
+ defcompression = COMPRESSION_LZW;
388
+ } else if (strneq(opt, "zip", 3)) {
389
+ processZIPOptions(opt);
390
+ defcompression = COMPRESSION_ADOBE_DEFLATE;
391
+ } else if (strneq(opt, "lzma", 4)) {
392
+ processZIPOptions(opt);
393
+ defcompression = COMPRESSION_LZMA;
394
+ } else if (strneq(opt, "jbig", 4)) {
395
+ defcompression = COMPRESSION_JBIG;
396
+ } else if (strneq(opt, "sgilog", 6)) {
397
+ defcompression = COMPRESSION_SGILOG;
398
+ } else
399
+ return (0);
400
+ return (1);
401
+ }
402
+
403
+ char* stuff[] = {
404
+ "usage: tiffcp [options] input... output",
405
+ "where options are:",
406
+ " -a append to output instead of overwriting",
407
+ " -o offset set initial directory offset",
408
+ " -p contig pack samples contiguously (e.g. RGBRGB...)",
409
+ " -p separate store samples separately (e.g. RRR...GGG...BBB...)",
410
+ " -s write output in strips",
411
+ " -t write output in tiles",
412
+ " -x force the merged tiff pages in sequence",
413
+ " -8 write BigTIFF instead of default ClassicTIFF",
414
+ " -B write big-endian instead of native byte order",
415
+ " -L write little-endian instead of native byte order",
416
+ " -M disable use of memory-mapped files",
417
+ " -C disable strip chopping",
418
+ " -i ignore read errors",
419
+ " -b file[,#] bias (dark) monochrome image to be subtracted from all others",
420
+ " -,=% use % rather than , to separate image #'s (per Note below)",
421
+ "",
422
+ " -r # make each strip have no more than # rows",
423
+ " -w # set output tile width (pixels)",
424
+ " -l # set output tile length (pixels)",
425
+ "",
426
+ " -f lsb2msb force lsb-to-msb FillOrder for output",
427
+ " -f msb2lsb force msb-to-lsb FillOrder for output",
428
+ "",
429
+ " -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
430
+ " -c zip[:opts] compress output with deflate encoding",
431
+ " -c lzma[:opts] compress output with LZMA2 encoding",
432
+ " -c jpeg[:opts] compress output with JPEG encoding",
433
+ " -c jbig compress output with ISO JBIG encoding",
434
+ " -c packbits compress output with packbits encoding",
435
+ " -c g3[:opts] compress output with CCITT Group 3 encoding",
436
+ " -c g4 compress output with CCITT Group 4 encoding",
437
+ " -c sgilog compress output with SGILOG encoding",
438
+ " -c none use no compression algorithm on output",
439
+ "",
440
+ "Group 3 options:",
441
+ " 1d use default CCITT Group 3 1D-encoding",
442
+ " 2d use optional CCITT Group 3 2D-encoding",
443
+ " fill byte-align EOL codes",
444
+ "For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",
445
+ "",
446
+ "JPEG options:",
447
+ " # set compression quality level (0-100, default 75)",
448
+ " r output color image as RGB rather than YCbCr",
449
+ "For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
450
+ "",
451
+ "LZW, Deflate (ZIP) and LZMA2 options:",
452
+ " # set predictor value",
453
+ " p# set compression level (preset)",
454
+ "For example, -c lzw:2 to get LZW-encoded data with horizontal differencing,",
455
+ "-c zip:3:p9 for Deflate encoding with maximum compression level and floating",
456
+ "point predictor.",
457
+ "",
458
+ "Note that input filenames may be of the form filename,x,y,z",
459
+ "where x, y, and z specify image numbers in the filename to copy.",
460
+ "example: tiffcp -c none -b esp.tif,1 esp.tif,0 test.tif",
461
+ " subtract 2nd image in esp.tif from 1st yielding uncompressed result test.tif",
462
+ NULL
463
+ };
464
+
465
+ static void
466
+ usage(void)
467
+ {
468
+ char buf[BUFSIZ];
469
+ int i;
470
+
471
+ setbuf(stderr, buf);
472
+ fprintf(stderr, "%s\n\n", TIFFGetVersion());
473
+ for (i = 0; stuff[i] != NULL; i++)
474
+ fprintf(stderr, "%s\n", stuff[i]);
475
+ exit(-1);
476
+ }
477
+
478
+ #define CopyField(tag, v) \
479
+ if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
480
+ #define CopyField2(tag, v1, v2) \
481
+ if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)
482
+ #define CopyField3(tag, v1, v2, v3) \
483
+ if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
484
+ #define CopyField4(tag, v1, v2, v3, v4) \
485
+ if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
486
+
487
+ static void
488
+ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
489
+ {
490
+ switch (type) {
491
+ case TIFF_SHORT:
492
+ if (count == 1) {
493
+ uint16 shortv;
494
+ CopyField(tag, shortv);
495
+ } else if (count == 2) {
496
+ uint16 shortv1, shortv2;
497
+ CopyField2(tag, shortv1, shortv2);
498
+ } else if (count == 4) {
499
+ uint16 *tr, *tg, *tb, *ta;
500
+ CopyField4(tag, tr, tg, tb, ta);
501
+ } else if (count == (uint16) -1) {
502
+ uint16 shortv1;
503
+ uint16* shortav;
504
+ CopyField2(tag, shortv1, shortav);
505
+ }
506
+ break;
507
+ case TIFF_LONG:
508
+ { uint32 longv;
509
+ CopyField(tag, longv);
510
+ }
511
+ break;
512
+ case TIFF_RATIONAL:
513
+ if (count == 1) {
514
+ float floatv;
515
+ CopyField(tag, floatv);
516
+ } else if (count == (uint16) -1) {
517
+ float* floatav;
518
+ CopyField(tag, floatav);
519
+ }
520
+ break;
521
+ case TIFF_ASCII:
522
+ { char* stringv;
523
+ CopyField(tag, stringv);
524
+ }
525
+ break;
526
+ case TIFF_DOUBLE:
527
+ if (count == 1) {
528
+ double doublev;
529
+ CopyField(tag, doublev);
530
+ } else if (count == (uint16) -1) {
531
+ double* doubleav;
532
+ CopyField(tag, doubleav);
533
+ }
534
+ break;
535
+ default:
536
+ TIFFError(TIFFFileName(in),
537
+ "Data type %d is not supported, tag %d skipped.",
538
+ tag, type);
539
+ }
540
+ }
541
+
542
+ static struct cpTag {
543
+ uint16 tag;
544
+ uint16 count;
545
+ TIFFDataType type;
546
+ } tags[] = {
547
+ { TIFFTAG_SUBFILETYPE, 1, TIFF_LONG },
548
+ { TIFFTAG_THRESHHOLDING, 1, TIFF_SHORT },
549
+ { TIFFTAG_DOCUMENTNAME, 1, TIFF_ASCII },
550
+ { TIFFTAG_IMAGEDESCRIPTION, 1, TIFF_ASCII },
551
+ { TIFFTAG_MAKE, 1, TIFF_ASCII },
552
+ { TIFFTAG_MODEL, 1, TIFF_ASCII },
553
+ { TIFFTAG_MINSAMPLEVALUE, 1, TIFF_SHORT },
554
+ { TIFFTAG_MAXSAMPLEVALUE, 1, TIFF_SHORT },
555
+ { TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
556
+ { TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
557
+ { TIFFTAG_PAGENAME, 1, TIFF_ASCII },
558
+ { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
559
+ { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
560
+ { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
561
+ { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
562
+ { TIFFTAG_DATETIME, 1, TIFF_ASCII },
563
+ { TIFFTAG_ARTIST, 1, TIFF_ASCII },
564
+ { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
565
+ { TIFFTAG_WHITEPOINT, (uint16) -1, TIFF_RATIONAL },
566
+ { TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
567
+ { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
568
+ { TIFFTAG_INKSET, 1, TIFF_SHORT },
569
+ { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
570
+ { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
571
+ { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
572
+ { TIFFTAG_YCBCRCOEFFICIENTS, (uint16) -1,TIFF_RATIONAL },
573
+ { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
574
+ { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
575
+ { TIFFTAG_REFERENCEBLACKWHITE, (uint16) -1,TIFF_RATIONAL },
576
+ { TIFFTAG_EXTRASAMPLES, (uint16) -1, TIFF_SHORT },
577
+ { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE },
578
+ { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE },
579
+ { TIFFTAG_STONITS, 1, TIFF_DOUBLE },
580
+ };
581
+ #define NTAGS (sizeof (tags) / sizeof (tags[0]))
582
+
583
+ #define CopyTag(tag, count, type) cpTag(in, out, tag, count, type)
584
+
585
+ typedef int (*copyFunc)
586
+ (TIFF* in, TIFF* out, uint32 l, uint32 w, uint16 samplesperpixel);
587
+ static copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16);
588
+
589
+ /* PODD */
590
+
591
+ static int
592
+ tiffcp(TIFF* in, TIFF* out)
593
+ {
594
+ uint16 bitspersample = 1, samplesperpixel = 1;
595
+ uint16 input_compression, input_photometric = PHOTOMETRIC_MINISBLACK;
596
+ copyFunc cf;
597
+ uint32 width, length;
598
+ struct cpTag* p;
599
+
600
+ CopyField(TIFFTAG_IMAGEWIDTH, width);
601
+ CopyField(TIFFTAG_IMAGELENGTH, length);
602
+ CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);
603
+ CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
604
+ if (compression != (uint16)-1)
605
+ TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
606
+ else
607
+ CopyField(TIFFTAG_COMPRESSION, compression);
608
+ TIFFGetFieldDefaulted(in, TIFFTAG_COMPRESSION, &input_compression);
609
+ TIFFGetFieldDefaulted(in, TIFFTAG_PHOTOMETRIC, &input_photometric);
610
+ if (input_compression == COMPRESSION_JPEG) {
611
+ /* Force conversion to RGB */
612
+ TIFFSetField(in, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
613
+ } else if (input_photometric == PHOTOMETRIC_YCBCR) {
614
+ /* Otherwise, can't handle subsampled input */
615
+ uint16 subsamplinghor,subsamplingver;
616
+
617
+ TIFFGetFieldDefaulted(in, TIFFTAG_YCBCRSUBSAMPLING,
618
+ &subsamplinghor, &subsamplingver);
619
+ if (subsamplinghor!=1 || subsamplingver!=1) {
620
+ fprintf(stderr, "tiffcp: %s: Can't copy/convert subsampled image.\n",
621
+ TIFFFileName(in));
622
+ return FALSE;
623
+ }
624
+ }
625
+ if (compression == COMPRESSION_JPEG) {
626
+ if (input_photometric == PHOTOMETRIC_RGB &&
627
+ jpegcolormode == JPEGCOLORMODE_RGB)
628
+ TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);
629
+ else
630
+ TIFFSetField(out, TIFFTAG_PHOTOMETRIC, input_photometric);
631
+ }
632
+ else if (compression == COMPRESSION_SGILOG
633
+ || compression == COMPRESSION_SGILOG24)
634
+ TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
635
+ samplesperpixel == 1 ?
636
+ PHOTOMETRIC_LOGL : PHOTOMETRIC_LOGLUV);
637
+ else if (input_compression == COMPRESSION_JPEG &&
638
+ samplesperpixel == 3 ) {
639
+ /* RGB conversion was forced above
640
+ hence the output will be of the same type */
641
+ TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
642
+ }
643
+ else
644
+ CopyTag(TIFFTAG_PHOTOMETRIC, 1, TIFF_SHORT);
645
+ if (fillorder != 0)
646
+ TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
647
+ else
648
+ CopyTag(TIFFTAG_FILLORDER, 1, TIFF_SHORT);
649
+ /*
650
+ * Will copy `Orientation' tag from input image
651
+ */
652
+ TIFFGetFieldDefaulted(in, TIFFTAG_ORIENTATION, &orientation);
653
+ switch (orientation) {
654
+ case ORIENTATION_BOTRIGHT:
655
+ case ORIENTATION_RIGHTBOT: /* XXX */
656
+ TIFFWarning(TIFFFileName(in), "using bottom-left orientation");
657
+ orientation = ORIENTATION_BOTLEFT;
658
+ /* fall thru... */
659
+ case ORIENTATION_LEFTBOT: /* XXX */
660
+ case ORIENTATION_BOTLEFT:
661
+ break;
662
+ case ORIENTATION_TOPRIGHT:
663
+ case ORIENTATION_RIGHTTOP: /* XXX */
664
+ default:
665
+ TIFFWarning(TIFFFileName(in), "using top-left orientation");
666
+ orientation = ORIENTATION_TOPLEFT;
667
+ /* fall thru... */
668
+ case ORIENTATION_LEFTTOP: /* XXX */
669
+ case ORIENTATION_TOPLEFT:
670
+ break;
671
+ }
672
+ TIFFSetField(out, TIFFTAG_ORIENTATION, orientation);
673
+ /*
674
+ * Choose tiles/strip for the output image according to
675
+ * the command line arguments (-tiles, -strips) and the
676
+ * structure of the input image.
677
+ */
678
+ if (outtiled == -1)
679
+ outtiled = TIFFIsTiled(in);
680
+ if (outtiled) {
681
+ /*
682
+ * Setup output file's tile width&height. If either
683
+ * is not specified, use either the value from the
684
+ * input image or, if nothing is defined, use the
685
+ * library default.
686
+ */
687
+ if (tilewidth == (uint32) -1)
688
+ TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);
689
+ if (tilelength == (uint32) -1)
690
+ TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);
691
+ TIFFDefaultTileSize(out, &tilewidth, &tilelength);
692
+ TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);
693
+ TIFFSetField(out, TIFFTAG_TILELENGTH, tilelength);
694
+ } else {
695
+ /*
696
+ * RowsPerStrip is left unspecified: use either the
697
+ * value from the input image or, if nothing is defined,
698
+ * use the library default.
699
+ */
700
+ if (rowsperstrip == (uint32) 0) {
701
+ if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP,
702
+ &rowsperstrip)) {
703
+ rowsperstrip =
704
+ TIFFDefaultStripSize(out, rowsperstrip);
705
+ }
706
+ if (rowsperstrip > length && rowsperstrip != (uint32)-1)
707
+ rowsperstrip = length;
708
+ }
709
+ else if (rowsperstrip == (uint32) -1)
710
+ rowsperstrip = length;
711
+ TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
712
+ }
713
+ if (config != (uint16) -1)
714
+ TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
715
+ else
716
+ CopyField(TIFFTAG_PLANARCONFIG, config);
717
+ if (samplesperpixel <= 4)
718
+ CopyTag(TIFFTAG_TRANSFERFUNCTION, 4, TIFF_SHORT);
719
+ CopyTag(TIFFTAG_COLORMAP, 4, TIFF_SHORT);
720
+ /* SMinSampleValue & SMaxSampleValue */
721
+ switch (compression) {
722
+ case COMPRESSION_JPEG:
723
+ TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
724
+ TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
725
+ break;
726
+ case COMPRESSION_JBIG:
727
+ CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);
728
+ CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);
729
+ CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);
730
+ CopyTag(TIFFTAG_FAXDCS, 1, TIFF_ASCII);
731
+ break;
732
+ case COMPRESSION_LZW:
733
+ case COMPRESSION_ADOBE_DEFLATE:
734
+ case COMPRESSION_DEFLATE:
735
+ case COMPRESSION_LZMA:
736
+ if (predictor != (uint16)-1)
737
+ TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
738
+ else
739
+ CopyField(TIFFTAG_PREDICTOR, predictor);
740
+ if (preset != -1) {
741
+ if (compression == COMPRESSION_ADOBE_DEFLATE
742
+ || compression == COMPRESSION_DEFLATE)
743
+ TIFFSetField(out, TIFFTAG_ZIPQUALITY, preset);
744
+ else if (compression == COMPRESSION_LZMA)
745
+ TIFFSetField(out, TIFFTAG_LZMAPRESET, preset);
746
+ }
747
+ break;
748
+ case COMPRESSION_CCITTFAX3:
749
+ case COMPRESSION_CCITTFAX4:
750
+ if (compression == COMPRESSION_CCITTFAX3) {
751
+ if (g3opts != (uint32) -1)
752
+ TIFFSetField(out, TIFFTAG_GROUP3OPTIONS,
753
+ g3opts);
754
+ else
755
+ CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);
756
+ } else
757
+ CopyTag(TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG);
758
+ CopyTag(TIFFTAG_BADFAXLINES, 1, TIFF_LONG);
759
+ CopyTag(TIFFTAG_CLEANFAXDATA, 1, TIFF_LONG);
760
+ CopyTag(TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG);
761
+ CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);
762
+ CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);
763
+ CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);
764
+ break;
765
+ }
766
+ {
767
+ uint32 len32;
768
+ void** data;
769
+ if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))
770
+ TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);
771
+ }
772
+ {
773
+ uint16 ninks;
774
+ const char* inknames;
775
+ if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
776
+ TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
777
+ if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {
778
+ int inknameslen = strlen(inknames) + 1;
779
+ const char* cp = inknames;
780
+ while (ninks > 1) {
781
+ cp = strchr(cp, '\0');
782
+ cp++;
783
+ inknameslen += (strlen(cp) + 1);
784
+ ninks--;
785
+ }
786
+ TIFFSetField(out, TIFFTAG_INKNAMES, inknameslen, inknames);
787
+ }
788
+ }
789
+ }
790
+ {
791
+ unsigned short pg0, pg1;
792
+
793
+ if (pageInSeq == 1) {
794
+ if (pageNum < 0) /* only one input file */ {
795
+ if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1))
796
+ TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
797
+ } else
798
+ TIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);
799
+
800
+ } else {
801
+ if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {
802
+ if (pageNum < 0) /* only one input file */
803
+ TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
804
+ else
805
+ TIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);
806
+ }
807
+ }
808
+ }
809
+
810
+ for (p = tags; p < &tags[NTAGS]; p++)
811
+ CopyTag(p->tag, p->count, p->type);
812
+
813
+ cf = pickCopyFunc(in, out, bitspersample, samplesperpixel);
814
+ return (cf ? (*cf)(in, out, length, width, samplesperpixel) : FALSE);
815
+ }
816
+
817
+ /*
818
+ * Copy Functions.
819
+ */
820
+ #define DECLAREcpFunc(x) \
821
+ static int x(TIFF* in, TIFF* out, \
822
+ uint32 imagelength, uint32 imagewidth, tsample_t spp)
823
+
824
+ #define DECLAREreadFunc(x) \
825
+ static int x(TIFF* in, \
826
+ uint8* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
827
+ typedef int (*readFunc)(TIFF*, uint8*, uint32, uint32, tsample_t);
828
+
829
+ #define DECLAREwriteFunc(x) \
830
+ static int x(TIFF* out, \
831
+ uint8* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
832
+ typedef int (*writeFunc)(TIFF*, uint8*, uint32, uint32, tsample_t);
833
+
834
+ /*
835
+ * Contig -> contig by scanline for rows/strip change.
836
+ */
837
+ DECLAREcpFunc(cpContig2ContigByRow)
838
+ {
839
+ tsize_t scanlinesize = TIFFScanlineSize(in);
840
+ tdata_t buf;
841
+ uint32 row;
842
+
843
+ buf = _TIFFmalloc(scanlinesize);
844
+ if (!buf)
845
+ return 0;
846
+ _TIFFmemset(buf, 0, scanlinesize);
847
+ (void) imagewidth; (void) spp;
848
+ for (row = 0; row < imagelength; row++) {
849
+ if (TIFFReadScanline(in, buf, row, 0) < 0 && !ignore) {
850
+ TIFFError(TIFFFileName(in),
851
+ "Error, can't read scanline %lu",
852
+ (unsigned long) row);
853
+ goto bad;
854
+ }
855
+ if (TIFFWriteScanline(out, buf, row, 0) < 0) {
856
+ TIFFError(TIFFFileName(out),
857
+ "Error, can't write scanline %lu",
858
+ (unsigned long) row);
859
+ goto bad;
860
+ }
861
+ }
862
+ _TIFFfree(buf);
863
+ return 1;
864
+ bad:
865
+ _TIFFfree(buf);
866
+ return 0;
867
+ }
868
+
869
+
870
+ typedef void biasFn (void *image, void *bias, uint32 pixels);
871
+
872
+ #define subtract(bits) \
873
+ static void subtract##bits (void *i, void *b, uint32 pixels)\
874
+ {\
875
+ uint##bits *image = i;\
876
+ uint##bits *bias = b;\
877
+ while (pixels--) {\
878
+ *image = *image > *bias ? *image-*bias : 0;\
879
+ image++, bias++; \
880
+ } \
881
+ }
882
+
883
+ subtract(8)
884
+ subtract(16)
885
+ subtract(32)
886
+
887
+ static biasFn *lineSubtractFn (unsigned bits)
888
+ {
889
+ switch (bits) {
890
+ case 8: return subtract8;
891
+ case 16: return subtract16;
892
+ case 32: return subtract32;
893
+ }
894
+ return NULL;
895
+ }
896
+
897
+ /*
898
+ * Contig -> contig by scanline while subtracting a bias image.
899
+ */
900
+ DECLAREcpFunc(cpBiasedContig2Contig)
901
+ {
902
+ if (spp == 1) {
903
+ tsize_t biasSize = TIFFScanlineSize(bias);
904
+ tsize_t bufSize = TIFFScanlineSize(in);
905
+ tdata_t buf, biasBuf;
906
+ uint32 biasWidth = 0, biasLength = 0;
907
+ TIFFGetField(bias, TIFFTAG_IMAGEWIDTH, &biasWidth);
908
+ TIFFGetField(bias, TIFFTAG_IMAGELENGTH, &biasLength);
909
+ if (biasSize == bufSize &&
910
+ imagelength == biasLength && imagewidth == biasWidth) {
911
+ uint16 sampleBits = 0;
912
+ biasFn *subtractLine;
913
+ TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &sampleBits);
914
+ subtractLine = lineSubtractFn (sampleBits);
915
+ if (subtractLine) {
916
+ uint32 row;
917
+ buf = _TIFFmalloc(bufSize);
918
+ biasBuf = _TIFFmalloc(bufSize);
919
+ for (row = 0; row < imagelength; row++) {
920
+ if (TIFFReadScanline(in, buf, row, 0) < 0
921
+ && !ignore) {
922
+ TIFFError(TIFFFileName(in),
923
+ "Error, can't read scanline %lu",
924
+ (unsigned long) row);
925
+ goto bad;
926
+ }
927
+ if (TIFFReadScanline(bias, biasBuf, row, 0) < 0
928
+ && !ignore) {
929
+ TIFFError(TIFFFileName(in),
930
+ "Error, can't read biased scanline %lu",
931
+ (unsigned long) row);
932
+ goto bad;
933
+ }
934
+ subtractLine (buf, biasBuf, imagewidth);
935
+ if (TIFFWriteScanline(out, buf, row, 0) < 0) {
936
+ TIFFError(TIFFFileName(out),
937
+ "Error, can't write scanline %lu",
938
+ (unsigned long) row);
939
+ goto bad;
940
+ }
941
+ }
942
+
943
+ _TIFFfree(buf);
944
+ _TIFFfree(biasBuf);
945
+ TIFFSetDirectory(bias,
946
+ TIFFCurrentDirectory(bias)); /* rewind */
947
+ return 1;
948
+ bad:
949
+ _TIFFfree(buf);
950
+ _TIFFfree(biasBuf);
951
+ return 0;
952
+ } else {
953
+ TIFFError(TIFFFileName(in),
954
+ "No support for biasing %d bit pixels\n",
955
+ sampleBits);
956
+ return 0;
957
+ }
958
+ }
959
+ TIFFError(TIFFFileName(in),
960
+ "Bias image %s,%d\nis not the same size as %s,%d\n",
961
+ TIFFFileName(bias), TIFFCurrentDirectory(bias),
962
+ TIFFFileName(in), TIFFCurrentDirectory(in));
963
+ return 0;
964
+ } else {
965
+ TIFFError(TIFFFileName(in),
966
+ "Can't bias %s,%d as it has >1 Sample/Pixel\n",
967
+ TIFFFileName(in), TIFFCurrentDirectory(in));
968
+ return 0;
969
+ }
970
+
971
+ }
972
+
973
+
974
+ /*
975
+ * Strip -> strip for change in encoding.
976
+ */
977
+ DECLAREcpFunc(cpDecodedStrips)
978
+ {
979
+ tsize_t stripsize = TIFFStripSize(in);
980
+ tdata_t buf = _TIFFmalloc(stripsize);
981
+
982
+ (void) imagewidth; (void) spp;
983
+ if (buf) {
984
+ tstrip_t s, ns = TIFFNumberOfStrips(in);
985
+ uint32 row = 0;
986
+ _TIFFmemset(buf, 0, stripsize);
987
+ for (s = 0; s < ns && row < imagelength; s++) {
988
+ tsize_t cc = (row + rowsperstrip > imagelength) ?
989
+ TIFFVStripSize(in, imagelength - row) : stripsize;
990
+ if (TIFFReadEncodedStrip(in, s, buf, cc) < 0
991
+ && !ignore) {
992
+ TIFFError(TIFFFileName(in),
993
+ "Error, can't read strip %lu",
994
+ (unsigned long) s);
995
+ goto bad;
996
+ }
997
+ if (TIFFWriteEncodedStrip(out, s, buf, cc) < 0) {
998
+ TIFFError(TIFFFileName(out),
999
+ "Error, can't write strip %lu",
1000
+ (unsigned long) s);
1001
+ goto bad;
1002
+ }
1003
+ row += rowsperstrip;
1004
+ }
1005
+ _TIFFfree(buf);
1006
+ return 1;
1007
+ } else {
1008
+ TIFFError(TIFFFileName(in),
1009
+ "Error, can't allocate memory buffer of size %lu "
1010
+ "to read strips", (unsigned long) stripsize);
1011
+ return 0;
1012
+ }
1013
+
1014
+ bad:
1015
+ _TIFFfree(buf);
1016
+ return 0;
1017
+ }
1018
+
1019
+ /*
1020
+ * Separate -> separate by row for rows/strip change.
1021
+ */
1022
+ DECLAREcpFunc(cpSeparate2SeparateByRow)
1023
+ {
1024
+ tsize_t scanlinesize = TIFFScanlineSize(in);
1025
+ tdata_t buf;
1026
+ uint32 row;
1027
+ tsample_t s;
1028
+
1029
+ (void) imagewidth;
1030
+ buf = _TIFFmalloc(scanlinesize);
1031
+ if (!buf)
1032
+ return 0;
1033
+ _TIFFmemset(buf, 0, scanlinesize);
1034
+ for (s = 0; s < spp; s++) {
1035
+ for (row = 0; row < imagelength; row++) {
1036
+ if (TIFFReadScanline(in, buf, row, s) < 0 && !ignore) {
1037
+ TIFFError(TIFFFileName(in),
1038
+ "Error, can't read scanline %lu",
1039
+ (unsigned long) row);
1040
+ goto bad;
1041
+ }
1042
+ if (TIFFWriteScanline(out, buf, row, s) < 0) {
1043
+ TIFFError(TIFFFileName(out),
1044
+ "Error, can't write scanline %lu",
1045
+ (unsigned long) row);
1046
+ goto bad;
1047
+ }
1048
+ }
1049
+ }
1050
+ _TIFFfree(buf);
1051
+ return 1;
1052
+ bad:
1053
+ _TIFFfree(buf);
1054
+ return 0;
1055
+ }
1056
+
1057
+ /*
1058
+ * Contig -> separate by row.
1059
+ */
1060
+ DECLAREcpFunc(cpContig2SeparateByRow)
1061
+ {
1062
+ tsize_t scanlinesizein = TIFFScanlineSize(in);
1063
+ tsize_t scanlinesizeout = TIFFScanlineSize(out);
1064
+ tdata_t inbuf;
1065
+ tdata_t outbuf;
1066
+ register uint8 *inp, *outp;
1067
+ register uint32 n;
1068
+ uint32 row;
1069
+ tsample_t s;
1070
+ uint16 bps = 0;
1071
+
1072
+ (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);
1073
+ if( bps != 8 )
1074
+ {
1075
+ TIFFError(TIFFFileName(in),
1076
+ "Error, can only handle BitsPerSample=8 in %s",
1077
+ "cpContig2SeparateByRow");
1078
+ return 0;
1079
+ }
1080
+
1081
+ inbuf = _TIFFmalloc(scanlinesizein);
1082
+ outbuf = _TIFFmalloc(scanlinesizeout);
1083
+ if (!inbuf || !outbuf)
1084
+ goto bad;
1085
+ _TIFFmemset(inbuf, 0, scanlinesizein);
1086
+ _TIFFmemset(outbuf, 0, scanlinesizeout);
1087
+ /* unpack channels */
1088
+ for (s = 0; s < spp; s++) {
1089
+ for (row = 0; row < imagelength; row++) {
1090
+ if (TIFFReadScanline(in, inbuf, row, 0) < 0
1091
+ && !ignore) {
1092
+ TIFFError(TIFFFileName(in),
1093
+ "Error, can't read scanline %lu",
1094
+ (unsigned long) row);
1095
+ goto bad;
1096
+ }
1097
+ inp = ((uint8*)inbuf) + s;
1098
+ outp = (uint8*)outbuf;
1099
+ for (n = imagewidth; n-- > 0;) {
1100
+ *outp++ = *inp;
1101
+ inp += spp;
1102
+ }
1103
+ if (TIFFWriteScanline(out, outbuf, row, s) < 0) {
1104
+ TIFFError(TIFFFileName(out),
1105
+ "Error, can't write scanline %lu",
1106
+ (unsigned long) row);
1107
+ goto bad;
1108
+ }
1109
+ }
1110
+ }
1111
+ if (inbuf) _TIFFfree(inbuf);
1112
+ if (outbuf) _TIFFfree(outbuf);
1113
+ return 1;
1114
+ bad:
1115
+ if (inbuf) _TIFFfree(inbuf);
1116
+ if (outbuf) _TIFFfree(outbuf);
1117
+ return 0;
1118
+ }
1119
+
1120
+ /*
1121
+ * Separate -> contig by row.
1122
+ */
1123
+ DECLAREcpFunc(cpSeparate2ContigByRow)
1124
+ {
1125
+ tsize_t scanlinesizein = TIFFScanlineSize(in);
1126
+ tsize_t scanlinesizeout = TIFFScanlineSize(out);
1127
+ tdata_t inbuf;
1128
+ tdata_t outbuf;
1129
+ register uint8 *inp, *outp;
1130
+ register uint32 n;
1131
+ uint32 row;
1132
+ tsample_t s;
1133
+ uint16 bps = 0;
1134
+
1135
+ (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);
1136
+ if( bps != 8 )
1137
+ {
1138
+ TIFFError(TIFFFileName(in),
1139
+ "Error, can only handle BitsPerSample=8 in %s",
1140
+ "cpSeparate2ContigByRow");
1141
+ return 0;
1142
+ }
1143
+
1144
+ inbuf = _TIFFmalloc(scanlinesizein);
1145
+ outbuf = _TIFFmalloc(scanlinesizeout);
1146
+ if (!inbuf || !outbuf)
1147
+ goto bad;
1148
+ _TIFFmemset(inbuf, 0, scanlinesizein);
1149
+ _TIFFmemset(outbuf, 0, scanlinesizeout);
1150
+ for (row = 0; row < imagelength; row++) {
1151
+ /* merge channels */
1152
+ for (s = 0; s < spp; s++) {
1153
+ if (TIFFReadScanline(in, inbuf, row, s) < 0
1154
+ && !ignore) {
1155
+ TIFFError(TIFFFileName(in),
1156
+ "Error, can't read scanline %lu",
1157
+ (unsigned long) row);
1158
+ goto bad;
1159
+ }
1160
+ inp = (uint8*)inbuf;
1161
+ outp = ((uint8*)outbuf) + s;
1162
+ for (n = imagewidth; n-- > 0;) {
1163
+ *outp = *inp++;
1164
+ outp += spp;
1165
+ }
1166
+ }
1167
+ if (TIFFWriteScanline(out, outbuf, row, 0) < 0) {
1168
+ TIFFError(TIFFFileName(out),
1169
+ "Error, can't write scanline %lu",
1170
+ (unsigned long) row);
1171
+ goto bad;
1172
+ }
1173
+ }
1174
+ if (inbuf) _TIFFfree(inbuf);
1175
+ if (outbuf) _TIFFfree(outbuf);
1176
+ return 1;
1177
+ bad:
1178
+ if (inbuf) _TIFFfree(inbuf);
1179
+ if (outbuf) _TIFFfree(outbuf);
1180
+ return 0;
1181
+ }
1182
+
1183
+ static void
1184
+ cpStripToTile(uint8* out, uint8* in,
1185
+ uint32 rows, uint32 cols, int outskew, int64 inskew)
1186
+ {
1187
+ while (rows-- > 0) {
1188
+ uint32 j = cols;
1189
+ while (j-- > 0)
1190
+ *out++ = *in++;
1191
+ out += outskew;
1192
+ in += inskew;
1193
+ }
1194
+ }
1195
+
1196
+ static void
1197
+ cpContigBufToSeparateBuf(uint8* out, uint8* in,
1198
+ uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp,
1199
+ int bytes_per_sample )
1200
+ {
1201
+ while (rows-- > 0) {
1202
+ uint32 j = cols;
1203
+ while (j-- > 0)
1204
+ {
1205
+ int n = bytes_per_sample;
1206
+
1207
+ while( n-- ) {
1208
+ *out++ = *in++;
1209
+ }
1210
+ in += (spp-1) * bytes_per_sample;
1211
+ }
1212
+ out += outskew;
1213
+ in += inskew;
1214
+ }
1215
+ }
1216
+
1217
+ static void
1218
+ cpSeparateBufToContigBuf(uint8* out, uint8* in,
1219
+ uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp,
1220
+ int bytes_per_sample)
1221
+ {
1222
+ while (rows-- > 0) {
1223
+ uint32 j = cols;
1224
+ while (j-- > 0) {
1225
+ int n = bytes_per_sample;
1226
+
1227
+ while( n-- ) {
1228
+ *out++ = *in++;
1229
+ }
1230
+ out += (spp-1)*bytes_per_sample;
1231
+ }
1232
+ out += outskew;
1233
+ in += inskew;
1234
+ }
1235
+ }
1236
+
1237
+ static int
1238
+ cpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout,
1239
+ uint32 imagelength, uint32 imagewidth, tsample_t spp)
1240
+ {
1241
+ int status = 0;
1242
+ tdata_t buf = NULL;
1243
+ tsize_t scanlinesize = TIFFRasterScanlineSize(in);
1244
+ tsize_t bytes = scanlinesize * (tsize_t)imagelength;
1245
+ /*
1246
+ * XXX: Check for integer overflow.
1247
+ */
1248
+ if (scanlinesize
1249
+ && imagelength
1250
+ && bytes / (tsize_t)imagelength == scanlinesize) {
1251
+ buf = _TIFFmalloc(bytes);
1252
+ if (buf) {
1253
+ if ((*fin)(in, (uint8*)buf, imagelength,
1254
+ imagewidth, spp)) {
1255
+ status = (*fout)(out, (uint8*)buf,
1256
+ imagelength, imagewidth, spp);
1257
+ }
1258
+ _TIFFfree(buf);
1259
+ } else {
1260
+ TIFFError(TIFFFileName(in),
1261
+ "Error, can't allocate space for image buffer");
1262
+ }
1263
+ } else {
1264
+ TIFFError(TIFFFileName(in), "Error, no space for image buffer");
1265
+ }
1266
+
1267
+ return status;
1268
+ }
1269
+
1270
+ DECLAREreadFunc(readContigStripsIntoBuffer)
1271
+ {
1272
+ tsize_t scanlinesize = TIFFScanlineSize(in);
1273
+ uint8* bufp = buf;
1274
+ uint32 row;
1275
+
1276
+ (void) imagewidth; (void) spp;
1277
+ for (row = 0; row < imagelength; row++) {
1278
+ if (TIFFReadScanline(in, (tdata_t) bufp, row, 0) < 0
1279
+ && !ignore) {
1280
+ TIFFError(TIFFFileName(in),
1281
+ "Error, can't read scanline %lu",
1282
+ (unsigned long) row);
1283
+ return 0;
1284
+ }
1285
+ bufp += scanlinesize;
1286
+ }
1287
+
1288
+ return 1;
1289
+ }
1290
+
1291
+ DECLAREreadFunc(readSeparateStripsIntoBuffer)
1292
+ {
1293
+ int status = 1;
1294
+ tsize_t scanlinesize = TIFFScanlineSize(in);
1295
+ tdata_t scanline;
1296
+ if (!scanlinesize)
1297
+ return 0;
1298
+
1299
+ scanline = _TIFFmalloc(scanlinesize);
1300
+ if (!scanline)
1301
+ return 0;
1302
+ _TIFFmemset(scanline, 0, scanlinesize);
1303
+ (void) imagewidth;
1304
+ if (scanline) {
1305
+ uint8* bufp = (uint8*) buf;
1306
+ uint32 row;
1307
+ tsample_t s;
1308
+ for (row = 0; row < imagelength; row++) {
1309
+ /* merge channels */
1310
+ for (s = 0; s < spp; s++) {
1311
+ uint8* bp = bufp + s;
1312
+ tsize_t n = scanlinesize;
1313
+ uint8* sbuf = scanline;
1314
+
1315
+ if (TIFFReadScanline(in, scanline, row, s) < 0
1316
+ && !ignore) {
1317
+ TIFFError(TIFFFileName(in),
1318
+ "Error, can't read scanline %lu",
1319
+ (unsigned long) row);
1320
+ status = 0;
1321
+ goto done;
1322
+ }
1323
+ while (n-- > 0)
1324
+ *bp = *sbuf++, bp += spp;
1325
+ }
1326
+ bufp += scanlinesize * spp;
1327
+ }
1328
+ }
1329
+
1330
+ done:
1331
+ _TIFFfree(scanline);
1332
+ return status;
1333
+ }
1334
+
1335
+ DECLAREreadFunc(readContigTilesIntoBuffer)
1336
+ {
1337
+ int status = 1;
1338
+ tsize_t tilesize = TIFFTileSize(in);
1339
+ tdata_t tilebuf;
1340
+ uint32 imagew = TIFFScanlineSize(in);
1341
+ uint32 tilew = TIFFTileRowSize(in);
1342
+ int64 iskew = (int64)imagew - (int64)tilew;
1343
+ uint8* bufp = (uint8*) buf;
1344
+ uint32 tw, tl;
1345
+ uint32 row;
1346
+
1347
+ (void) spp;
1348
+ tilebuf = _TIFFmalloc(tilesize);
1349
+ if (tilebuf == 0)
1350
+ return 0;
1351
+ _TIFFmemset(tilebuf, 0, tilesize);
1352
+ (void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
1353
+ (void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
1354
+
1355
+ for (row = 0; row < imagelength; row += tl) {
1356
+ uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
1357
+ uint32 colb = 0;
1358
+ uint32 col;
1359
+
1360
+ for (col = 0; col < imagewidth && colb < imagew; col += tw) {
1361
+ if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0
1362
+ && !ignore) {
1363
+ TIFFError(TIFFFileName(in),
1364
+ "Error, can't read tile at %lu %lu",
1365
+ (unsigned long) col,
1366
+ (unsigned long) row);
1367
+ status = 0;
1368
+ goto done;
1369
+ }
1370
+ if (colb > iskew) {
1371
+ uint32 width = imagew - colb;
1372
+ uint32 oskew = tilew - width;
1373
+ cpStripToTile(bufp + colb,
1374
+ tilebuf, nrow, width,
1375
+ oskew + iskew, oskew );
1376
+ } else
1377
+ cpStripToTile(bufp + colb,
1378
+ tilebuf, nrow, tilew,
1379
+ iskew, 0);
1380
+ colb += tilew;
1381
+ }
1382
+ bufp += imagew * nrow;
1383
+ }
1384
+ done:
1385
+ _TIFFfree(tilebuf);
1386
+ return status;
1387
+ }
1388
+
1389
+ DECLAREreadFunc(readSeparateTilesIntoBuffer)
1390
+ {
1391
+ int status = 1;
1392
+ uint32 imagew = TIFFRasterScanlineSize(in);
1393
+ uint32 tilew = TIFFTileRowSize(in);
1394
+ int iskew = imagew - tilew*spp;
1395
+ tsize_t tilesize = TIFFTileSize(in);
1396
+ tdata_t tilebuf;
1397
+ uint8* bufp = (uint8*) buf;
1398
+ uint32 tw, tl;
1399
+ uint32 row;
1400
+ uint16 bps = 0, bytes_per_sample;
1401
+
1402
+ tilebuf = _TIFFmalloc(tilesize);
1403
+ if (tilebuf == 0)
1404
+ return 0;
1405
+ _TIFFmemset(tilebuf, 0, tilesize);
1406
+ (void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
1407
+ (void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
1408
+ (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);
1409
+ if( bps == 0 )
1410
+ {
1411
+ TIFFError(TIFFFileName(in), "Error, cannot read BitsPerSample");
1412
+ status = 0;
1413
+ goto done;
1414
+ }
1415
+ if( (bps % 8) != 0 )
1416
+ {
1417
+ TIFFError(TIFFFileName(in), "Error, cannot handle BitsPerSample that is not a multiple of 8");
1418
+ status = 0;
1419
+ goto done;
1420
+ }
1421
+ bytes_per_sample = bps/8;
1422
+
1423
+ for (row = 0; row < imagelength; row += tl) {
1424
+ uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
1425
+ uint32 colb = 0;
1426
+ uint32 col;
1427
+
1428
+ for (col = 0; col < imagewidth; col += tw) {
1429
+ tsample_t s;
1430
+
1431
+ for (s = 0; s < spp; s++) {
1432
+ if (TIFFReadTile(in, tilebuf, col, row, 0, s) < 0
1433
+ && !ignore) {
1434
+ TIFFError(TIFFFileName(in),
1435
+ "Error, can't read tile at %lu %lu, "
1436
+ "sample %lu",
1437
+ (unsigned long) col,
1438
+ (unsigned long) row,
1439
+ (unsigned long) s);
1440
+ status = 0;
1441
+ goto done;
1442
+ }
1443
+ /*
1444
+ * Tile is clipped horizontally. Calculate
1445
+ * visible portion and skewing factors.
1446
+ */
1447
+ if (colb + tilew*spp > imagew) {
1448
+ uint32 width = imagew - colb;
1449
+ int oskew = tilew*spp - width;
1450
+ cpSeparateBufToContigBuf(
1451
+ bufp+colb+s*bytes_per_sample,
1452
+ tilebuf, nrow,
1453
+ width/(spp*bytes_per_sample),
1454
+ oskew + iskew,
1455
+ oskew/spp, spp,
1456
+ bytes_per_sample);
1457
+ } else
1458
+ cpSeparateBufToContigBuf(
1459
+ bufp+colb+s*bytes_per_sample,
1460
+ tilebuf, nrow, tw,
1461
+ iskew, 0, spp,
1462
+ bytes_per_sample);
1463
+ }
1464
+ colb += tilew*spp;
1465
+ }
1466
+ bufp += imagew * nrow;
1467
+ }
1468
+ done:
1469
+ _TIFFfree(tilebuf);
1470
+ return status;
1471
+ }
1472
+
1473
+ DECLAREwriteFunc(writeBufferToContigStrips)
1474
+ {
1475
+ uint32 row, rowsperstrip;
1476
+ tstrip_t strip = 0;
1477
+
1478
+ (void) imagewidth; (void) spp;
1479
+ (void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
1480
+ for (row = 0; row < imagelength; row += rowsperstrip) {
1481
+ uint32 nrows = (row+rowsperstrip > imagelength) ?
1482
+ imagelength-row : rowsperstrip;
1483
+ tsize_t stripsize = TIFFVStripSize(out, nrows);
1484
+ if (TIFFWriteEncodedStrip(out, strip++, buf, stripsize) < 0) {
1485
+ TIFFError(TIFFFileName(out),
1486
+ "Error, can't write strip %u", strip - 1);
1487
+ return 0;
1488
+ }
1489
+ buf += stripsize;
1490
+ }
1491
+ return 1;
1492
+ }
1493
+
1494
+ DECLAREwriteFunc(writeBufferToSeparateStrips)
1495
+ {
1496
+ uint32 rowsize = imagewidth * spp;
1497
+ uint32 rowsperstrip;
1498
+ tsize_t stripsize = TIFFStripSize(out);
1499
+ tdata_t obuf;
1500
+ tstrip_t strip = 0;
1501
+ tsample_t s;
1502
+
1503
+ obuf = _TIFFmalloc(stripsize);
1504
+ if (obuf == NULL)
1505
+ return (0);
1506
+ _TIFFmemset(obuf, 0, stripsize);
1507
+ (void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
1508
+ for (s = 0; s < spp; s++) {
1509
+ uint32 row;
1510
+ for (row = 0; row < imagelength; row += rowsperstrip) {
1511
+ uint32 nrows = (row+rowsperstrip > imagelength) ?
1512
+ imagelength-row : rowsperstrip;
1513
+ tsize_t stripsize = TIFFVStripSize(out, nrows);
1514
+
1515
+ cpContigBufToSeparateBuf(
1516
+ obuf, (uint8*) buf + row*rowsize + s,
1517
+ nrows, imagewidth, 0, 0, spp, 1);
1518
+ if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) {
1519
+ TIFFError(TIFFFileName(out),
1520
+ "Error, can't write strip %u",
1521
+ strip - 1);
1522
+ _TIFFfree(obuf);
1523
+ return 0;
1524
+ }
1525
+ }
1526
+ }
1527
+ _TIFFfree(obuf);
1528
+ return 1;
1529
+
1530
+ }
1531
+
1532
+ DECLAREwriteFunc(writeBufferToContigTiles)
1533
+ {
1534
+ uint32 imagew = TIFFScanlineSize(out);
1535
+ uint32 tilew = TIFFTileRowSize(out);
1536
+ int iskew = imagew - tilew;
1537
+ tsize_t tilesize = TIFFTileSize(out);
1538
+ tdata_t obuf;
1539
+ uint8* bufp = (uint8*) buf;
1540
+ uint32 tl, tw;
1541
+ uint32 row;
1542
+
1543
+ (void) spp;
1544
+
1545
+ obuf = _TIFFmalloc(TIFFTileSize(out));
1546
+ if (obuf == NULL)
1547
+ return 0;
1548
+ _TIFFmemset(obuf, 0, tilesize);
1549
+ (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
1550
+ (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
1551
+ for (row = 0; row < imagelength; row += tilelength) {
1552
+ uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
1553
+ uint32 colb = 0;
1554
+ uint32 col;
1555
+
1556
+ for (col = 0; col < imagewidth && colb < imagew; col += tw) {
1557
+ /*
1558
+ * Tile is clipped horizontally. Calculate
1559
+ * visible portion and skewing factors.
1560
+ */
1561
+ if (colb + tilew > imagew) {
1562
+ uint32 width = imagew - colb;
1563
+ int oskew = tilew - width;
1564
+ cpStripToTile(obuf, bufp + colb, nrow, width,
1565
+ oskew, oskew + iskew);
1566
+ } else
1567
+ cpStripToTile(obuf, bufp + colb, nrow, tilew,
1568
+ 0, iskew);
1569
+ if (TIFFWriteTile(out, obuf, col, row, 0, 0) < 0) {
1570
+ TIFFError(TIFFFileName(out),
1571
+ "Error, can't write tile at %lu %lu",
1572
+ (unsigned long) col,
1573
+ (unsigned long) row);
1574
+ _TIFFfree(obuf);
1575
+ return 0;
1576
+ }
1577
+ colb += tilew;
1578
+ }
1579
+ bufp += nrow * imagew;
1580
+ }
1581
+ _TIFFfree(obuf);
1582
+ return 1;
1583
+ }
1584
+
1585
+ DECLAREwriteFunc(writeBufferToSeparateTiles)
1586
+ {
1587
+ uint32 imagew = TIFFScanlineSize(out);
1588
+ tsize_t tilew = TIFFTileRowSize(out);
1589
+ uint32 iimagew = TIFFRasterScanlineSize(out);
1590
+ int iskew = iimagew - tilew*spp;
1591
+ tsize_t tilesize = TIFFTileSize(out);
1592
+ tdata_t obuf;
1593
+ uint8* bufp = (uint8*) buf;
1594
+ uint32 tl, tw;
1595
+ uint32 row;
1596
+ uint16 bps = 0, bytes_per_sample;
1597
+
1598
+ obuf = _TIFFmalloc(TIFFTileSize(out));
1599
+ if (obuf == NULL)
1600
+ return 0;
1601
+ _TIFFmemset(obuf, 0, tilesize);
1602
+ (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
1603
+ (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
1604
+ (void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);
1605
+ if( bps == 0 )
1606
+ {
1607
+ TIFFError(TIFFFileName(out), "Error, cannot read BitsPerSample");
1608
+ _TIFFfree(obuf);
1609
+ return 0;
1610
+ }
1611
+ if( (bps % 8) != 0 )
1612
+ {
1613
+ TIFFError(TIFFFileName(out), "Error, cannot handle BitsPerSample that is not a multiple of 8");
1614
+ _TIFFfree(obuf);
1615
+ return 0;
1616
+ }
1617
+ bytes_per_sample = bps/8;
1618
+
1619
+ for (row = 0; row < imagelength; row += tl) {
1620
+ uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
1621
+ uint32 colb = 0;
1622
+ uint32 col;
1623
+
1624
+ for (col = 0; col < imagewidth; col += tw) {
1625
+ tsample_t s;
1626
+ for (s = 0; s < spp; s++) {
1627
+ /*
1628
+ * Tile is clipped horizontally. Calculate
1629
+ * visible portion and skewing factors.
1630
+ */
1631
+ if (colb + tilew > imagew) {
1632
+ uint32 width = (imagew - colb);
1633
+ int oskew = tilew - width;
1634
+
1635
+ cpContigBufToSeparateBuf(obuf,
1636
+ bufp + (colb*spp) + s,
1637
+ nrow, width/bytes_per_sample,
1638
+ oskew, (oskew*spp)+iskew, spp,
1639
+ bytes_per_sample);
1640
+ } else
1641
+ cpContigBufToSeparateBuf(obuf,
1642
+ bufp + (colb*spp) + s,
1643
+ nrow, tilewidth,
1644
+ 0, iskew, spp,
1645
+ bytes_per_sample);
1646
+ if (TIFFWriteTile(out, obuf, col, row, 0, s) < 0) {
1647
+ TIFFError(TIFFFileName(out),
1648
+ "Error, can't write tile at %lu %lu "
1649
+ "sample %lu",
1650
+ (unsigned long) col,
1651
+ (unsigned long) row,
1652
+ (unsigned long) s);
1653
+ _TIFFfree(obuf);
1654
+ return 0;
1655
+ }
1656
+ }
1657
+ colb += tilew;
1658
+ }
1659
+ bufp += nrow * iimagew;
1660
+ }
1661
+ _TIFFfree(obuf);
1662
+ return 1;
1663
+ }
1664
+
1665
+ /*
1666
+ * Contig strips -> contig tiles.
1667
+ */
1668
+ DECLAREcpFunc(cpContigStrips2ContigTiles)
1669
+ {
1670
+ return cpImage(in, out,
1671
+ readContigStripsIntoBuffer,
1672
+ writeBufferToContigTiles,
1673
+ imagelength, imagewidth, spp);
1674
+ }
1675
+
1676
+ /*
1677
+ * Contig strips -> separate tiles.
1678
+ */
1679
+ DECLAREcpFunc(cpContigStrips2SeparateTiles)
1680
+ {
1681
+ return cpImage(in, out,
1682
+ readContigStripsIntoBuffer,
1683
+ writeBufferToSeparateTiles,
1684
+ imagelength, imagewidth, spp);
1685
+ }
1686
+
1687
+ /*
1688
+ * Separate strips -> contig tiles.
1689
+ */
1690
+ DECLAREcpFunc(cpSeparateStrips2ContigTiles)
1691
+ {
1692
+ return cpImage(in, out,
1693
+ readSeparateStripsIntoBuffer,
1694
+ writeBufferToContigTiles,
1695
+ imagelength, imagewidth, spp);
1696
+ }
1697
+
1698
+ /*
1699
+ * Separate strips -> separate tiles.
1700
+ */
1701
+ DECLAREcpFunc(cpSeparateStrips2SeparateTiles)
1702
+ {
1703
+ return cpImage(in, out,
1704
+ readSeparateStripsIntoBuffer,
1705
+ writeBufferToSeparateTiles,
1706
+ imagelength, imagewidth, spp);
1707
+ }
1708
+
1709
+ /*
1710
+ * Contig strips -> contig tiles.
1711
+ */
1712
+ DECLAREcpFunc(cpContigTiles2ContigTiles)
1713
+ {
1714
+ return cpImage(in, out,
1715
+ readContigTilesIntoBuffer,
1716
+ writeBufferToContigTiles,
1717
+ imagelength, imagewidth, spp);
1718
+ }
1719
+
1720
+ /*
1721
+ * Contig tiles -> separate tiles.
1722
+ */
1723
+ DECLAREcpFunc(cpContigTiles2SeparateTiles)
1724
+ {
1725
+ return cpImage(in, out,
1726
+ readContigTilesIntoBuffer,
1727
+ writeBufferToSeparateTiles,
1728
+ imagelength, imagewidth, spp);
1729
+ }
1730
+
1731
+ /*
1732
+ * Separate tiles -> contig tiles.
1733
+ */
1734
+ DECLAREcpFunc(cpSeparateTiles2ContigTiles)
1735
+ {
1736
+ return cpImage(in, out,
1737
+ readSeparateTilesIntoBuffer,
1738
+ writeBufferToContigTiles,
1739
+ imagelength, imagewidth, spp);
1740
+ }
1741
+
1742
+ /*
1743
+ * Separate tiles -> separate tiles (tile dimension change).
1744
+ */
1745
+ DECLAREcpFunc(cpSeparateTiles2SeparateTiles)
1746
+ {
1747
+ return cpImage(in, out,
1748
+ readSeparateTilesIntoBuffer,
1749
+ writeBufferToSeparateTiles,
1750
+ imagelength, imagewidth, spp);
1751
+ }
1752
+
1753
+ /*
1754
+ * Contig tiles -> contig tiles (tile dimension change).
1755
+ */
1756
+ DECLAREcpFunc(cpContigTiles2ContigStrips)
1757
+ {
1758
+ return cpImage(in, out,
1759
+ readContigTilesIntoBuffer,
1760
+ writeBufferToContigStrips,
1761
+ imagelength, imagewidth, spp);
1762
+ }
1763
+
1764
+ /*
1765
+ * Contig tiles -> separate strips.
1766
+ */
1767
+ DECLAREcpFunc(cpContigTiles2SeparateStrips)
1768
+ {
1769
+ return cpImage(in, out,
1770
+ readContigTilesIntoBuffer,
1771
+ writeBufferToSeparateStrips,
1772
+ imagelength, imagewidth, spp);
1773
+ }
1774
+
1775
+ /*
1776
+ * Separate tiles -> contig strips.
1777
+ */
1778
+ DECLAREcpFunc(cpSeparateTiles2ContigStrips)
1779
+ {
1780
+ return cpImage(in, out,
1781
+ readSeparateTilesIntoBuffer,
1782
+ writeBufferToContigStrips,
1783
+ imagelength, imagewidth, spp);
1784
+ }
1785
+
1786
+ /*
1787
+ * Separate tiles -> separate strips.
1788
+ */
1789
+ DECLAREcpFunc(cpSeparateTiles2SeparateStrips)
1790
+ {
1791
+ return cpImage(in, out,
1792
+ readSeparateTilesIntoBuffer,
1793
+ writeBufferToSeparateStrips,
1794
+ imagelength, imagewidth, spp);
1795
+ }
1796
+
1797
+ /*
1798
+ * Select the appropriate copy function to use.
1799
+ */
1800
+ static copyFunc
1801
+ pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
1802
+ {
1803
+ uint16 shortv;
1804
+ uint32 w, l, tw, tl;
1805
+ int bychunk;
1806
+
1807
+ (void) TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &shortv);
1808
+ if (shortv != config && bitspersample != 8 && samplesperpixel > 1) {
1809
+ fprintf(stderr,
1810
+ "%s: Cannot handle different planar configuration w/ bits/sample != 8\n",
1811
+ TIFFFileName(in));
1812
+ return (NULL);
1813
+ }
1814
+ TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);
1815
+ TIFFGetField(in, TIFFTAG_IMAGELENGTH, &l);
1816
+ if (!(TIFFIsTiled(out) || TIFFIsTiled(in))) {
1817
+ uint32 irps = (uint32) -1L;
1818
+ TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps);
1819
+ /* if biased, force decoded copying to allow image subtraction */
1820
+ bychunk = !bias && (rowsperstrip == irps);
1821
+ }else{ /* either in or out is tiled */
1822
+ if (bias) {
1823
+ fprintf(stderr,
1824
+ "%s: Cannot handle tiled configuration w/bias image\n",
1825
+ TIFFFileName(in));
1826
+ return (NULL);
1827
+ }
1828
+ if (TIFFIsTiled(out)) {
1829
+ if (!TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw))
1830
+ tw = w;
1831
+ if (!TIFFGetField(in, TIFFTAG_TILELENGTH, &tl))
1832
+ tl = l;
1833
+ bychunk = (tw == tilewidth && tl == tilelength);
1834
+ } else { /* out's not, so in must be tiled */
1835
+ TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
1836
+ TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
1837
+ bychunk = (tw == w && tl == rowsperstrip);
1838
+ }
1839
+ }
1840
+ #define T 1
1841
+ #define F 0
1842
+ #define pack(a,b,c,d,e) ((long)(((a)<<11)|((b)<<3)|((c)<<2)|((d)<<1)|(e)))
1843
+ switch(pack(shortv,config,TIFFIsTiled(in),TIFFIsTiled(out),bychunk)) {
1844
+ /* Strips -> Tiles */
1845
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,T,F):
1846
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,T,T):
1847
+ return cpContigStrips2ContigTiles;
1848
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,T,F):
1849
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,T,T):
1850
+ return cpContigStrips2SeparateTiles;
1851
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,T,F):
1852
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,T,T):
1853
+ return cpSeparateStrips2ContigTiles;
1854
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,F):
1855
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,T):
1856
+ return cpSeparateStrips2SeparateTiles;
1857
+ /* Tiles -> Tiles */
1858
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,T,F):
1859
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,T,T):
1860
+ return cpContigTiles2ContigTiles;
1861
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,T,F):
1862
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,T,T):
1863
+ return cpContigTiles2SeparateTiles;
1864
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,T,F):
1865
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,T,T):
1866
+ return cpSeparateTiles2ContigTiles;
1867
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,F):
1868
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,T):
1869
+ return cpSeparateTiles2SeparateTiles;
1870
+ /* Tiles -> Strips */
1871
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,F,F):
1872
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,F,T):
1873
+ return cpContigTiles2ContigStrips;
1874
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,F,F):
1875
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,F,T):
1876
+ return cpContigTiles2SeparateStrips;
1877
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,F,F):
1878
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,F,T):
1879
+ return cpSeparateTiles2ContigStrips;
1880
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,F):
1881
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,T):
1882
+ return cpSeparateTiles2SeparateStrips;
1883
+ /* Strips -> Strips */
1884
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,F,F):
1885
+ return bias ? cpBiasedContig2Contig : cpContig2ContigByRow;
1886
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,F,T):
1887
+ return cpDecodedStrips;
1888
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,F,F):
1889
+ case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,F,T):
1890
+ return cpContig2SeparateByRow;
1891
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,F,F):
1892
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,F,T):
1893
+ return cpSeparate2ContigByRow;
1894
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,F):
1895
+ case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,T):
1896
+ return cpSeparate2SeparateByRow;
1897
+ }
1898
+ #undef pack
1899
+ #undef F
1900
+ #undef T
1901
+ fprintf(stderr, "tiffcp: %s: Don't know how to copy/convert image.\n",
1902
+ TIFFFileName(in));
1903
+ return (NULL);
1904
+ }
1905
+
1906
+ /* vim: set ts=8 sts=8 sw=8 noet: */
1907
+ /*
1908
+ * Local Variables:
1909
+ * mode: c
1910
+ * c-basic-offset: 8
1911
+ * fill-column: 78
1912
+ * End:
1913
+ */