isbn 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. data/{README → README.md} +5 -11
  2. data/Rakefile +20 -14
  3. data/isbn.gemspec +23 -0
  4. data/lib/isbn.rb +2 -0
  5. data/test/isbn_spec.rb +1 -1
  6. metadata +29 -316
  7. data/VERSION +0 -1
  8. data/src/gocr-0.48/.cvsignore +0 -6
  9. data/src/gocr-0.48/AUTHORS +0 -7
  10. data/src/gocr-0.48/BUGS +0 -55
  11. data/src/gocr-0.48/CREDITS +0 -17
  12. data/src/gocr-0.48/HISTORY +0 -243
  13. data/src/gocr-0.48/INSTALL +0 -83
  14. data/src/gocr-0.48/Makefile +0 -193
  15. data/src/gocr-0.48/Makefile.in +0 -193
  16. data/src/gocr-0.48/README +0 -165
  17. data/src/gocr-0.48/READMEde.txt +0 -80
  18. data/src/gocr-0.48/REMARK.txt +0 -18
  19. data/src/gocr-0.48/REVIEW +0 -538
  20. data/src/gocr-0.48/TODO +0 -65
  21. data/src/gocr-0.48/bin/.cvsignore +0 -2
  22. data/src/gocr-0.48/bin/create_db +0 -38
  23. data/src/gocr-0.48/bin/gocr.tcl +0 -527
  24. data/src/gocr-0.48/bin/gocr_chk.sh +0 -44
  25. data/src/gocr-0.48/configure +0 -4689
  26. data/src/gocr-0.48/configure.in +0 -71
  27. data/src/gocr-0.48/doc/.#Makefile.1.6 +0 -39
  28. data/src/gocr-0.48/doc/.cvsignore +0 -2
  29. data/src/gocr-0.48/doc/Makefile +0 -39
  30. data/src/gocr-0.48/doc/Makefile.in +0 -39
  31. data/src/gocr-0.48/doc/example.dtd +0 -53
  32. data/src/gocr-0.48/doc/example.xml +0 -21
  33. data/src/gocr-0.48/doc/examples.txt +0 -67
  34. data/src/gocr-0.48/doc/gocr.html +0 -578
  35. data/src/gocr-0.48/doc/unicode.txt +0 -57
  36. data/src/gocr-0.48/examples/.#Makefile.1.22 +0 -166
  37. data/src/gocr-0.48/examples/4x6.png +0 -0
  38. data/src/gocr-0.48/examples/4x6.txt +0 -2
  39. data/src/gocr-0.48/examples/5x7.png +0 -0
  40. data/src/gocr-0.48/examples/5x7.png.txt +0 -2
  41. data/src/gocr-0.48/examples/5x8.png +0 -0
  42. data/src/gocr-0.48/examples/5x8.png.txt +0 -2
  43. data/src/gocr-0.48/examples/Makefile +0 -166
  44. data/src/gocr-0.48/examples/color.fig +0 -20
  45. data/src/gocr-0.48/examples/ex.fig +0 -16
  46. data/src/gocr-0.48/examples/font.tex +0 -22
  47. data/src/gocr-0.48/examples/font1.tex +0 -46
  48. data/src/gocr-0.48/examples/font2.fig +0 -27
  49. data/src/gocr-0.48/examples/font_nw.tex +0 -24
  50. data/src/gocr-0.48/examples/handwrt1.jpg +0 -0
  51. data/src/gocr-0.48/examples/handwrt1.txt +0 -10
  52. data/src/gocr-0.48/examples/inverse.fig +0 -20
  53. data/src/gocr-0.48/examples/matrix.jpg +0 -0
  54. data/src/gocr-0.48/examples/ocr-a-subset.png +0 -0
  55. data/src/gocr-0.48/examples/ocr-a-subset.png.txt +0 -4
  56. data/src/gocr-0.48/examples/ocr-a.png +0 -0
  57. data/src/gocr-0.48/examples/ocr-a.txt +0 -6
  58. data/src/gocr-0.48/examples/ocr-b.png +0 -0
  59. data/src/gocr-0.48/examples/ocr-b.png.txt +0 -4
  60. data/src/gocr-0.48/examples/polish.tex +0 -28
  61. data/src/gocr-0.48/examples/rotate45.fig +0 -14
  62. data/src/gocr-0.48/examples/score +0 -36
  63. data/src/gocr-0.48/examples/text.tex +0 -28
  64. data/src/gocr-0.48/gpl.html +0 -537
  65. data/src/gocr-0.48/include/.cvsignore +0 -2
  66. data/src/gocr-0.48/include/config.h +0 -36
  67. data/src/gocr-0.48/include/config.h.in +0 -36
  68. data/src/gocr-0.48/include/version.h +0 -2
  69. data/src/gocr-0.48/install-sh +0 -3
  70. data/src/gocr-0.48/make.bat +0 -57
  71. data/src/gocr-0.48/man/.cvsignore +0 -2
  72. data/src/gocr-0.48/man/Makefile +0 -29
  73. data/src/gocr-0.48/man/Makefile.in +0 -29
  74. data/src/gocr-0.48/man/man1/gocr.1 +0 -166
  75. data/src/gocr-0.48/src/.cvsignore +0 -4
  76. data/src/gocr-0.48/src/Makefile +0 -132
  77. data/src/gocr-0.48/src/Makefile.in +0 -132
  78. data/src/gocr-0.48/src/amiga.h +0 -31
  79. data/src/gocr-0.48/src/barcode.c +0 -846
  80. data/src/gocr-0.48/src/barcode.c.orig +0 -593
  81. data/src/gocr-0.48/src/barcode.h +0 -11
  82. data/src/gocr-0.48/src/box.c +0 -372
  83. data/src/gocr-0.48/src/database.c +0 -462
  84. data/src/gocr-0.48/src/detect.c +0 -943
  85. data/src/gocr-0.48/src/gocr.c +0 -373
  86. data/src/gocr-0.48/src/gocr.h +0 -288
  87. data/src/gocr-0.48/src/jconv.c +0 -168
  88. data/src/gocr-0.48/src/job.c +0 -84
  89. data/src/gocr-0.48/src/lines.c +0 -350
  90. data/src/gocr-0.48/src/list.c +0 -334
  91. data/src/gocr-0.48/src/list.h +0 -90
  92. data/src/gocr-0.48/src/ocr0.c +0 -6756
  93. data/src/gocr-0.48/src/ocr0.h +0 -63
  94. data/src/gocr-0.48/src/ocr0n.c +0 -1475
  95. data/src/gocr-0.48/src/ocr1.c +0 -85
  96. data/src/gocr-0.48/src/ocr1.h +0 -3
  97. data/src/gocr-0.48/src/otsu.c +0 -289
  98. data/src/gocr-0.48/src/otsu.h +0 -23
  99. data/src/gocr-0.48/src/output.c +0 -289
  100. data/src/gocr-0.48/src/output.h +0 -37
  101. data/src/gocr-0.48/src/pcx.c +0 -153
  102. data/src/gocr-0.48/src/pcx.h +0 -9
  103. data/src/gocr-0.48/src/pgm2asc.c +0 -2893
  104. data/src/gocr-0.48/src/pgm2asc.h +0 -105
  105. data/src/gocr-0.48/src/pixel.c +0 -537
  106. data/src/gocr-0.48/src/pnm.c +0 -533
  107. data/src/gocr-0.48/src/pnm.h +0 -35
  108. data/src/gocr-0.48/src/progress.c +0 -87
  109. data/src/gocr-0.48/src/progress.h +0 -42
  110. data/src/gocr-0.48/src/remove.c +0 -703
  111. data/src/gocr-0.48/src/tga.c +0 -87
  112. data/src/gocr-0.48/src/tga.h +0 -6
  113. data/src/gocr-0.48/src/unicode.c +0 -1314
  114. data/src/gocr-0.48/src/unicode.h +0 -1257
  115. data/src/jpeg-7/Makefile.am +0 -133
  116. data/src/jpeg-7/Makefile.in +0 -1089
  117. data/src/jpeg-7/README +0 -322
  118. data/src/jpeg-7/aclocal.m4 +0 -8990
  119. data/src/jpeg-7/ansi2knr.1 +0 -36
  120. data/src/jpeg-7/ansi2knr.c +0 -739
  121. data/src/jpeg-7/cderror.h +0 -132
  122. data/src/jpeg-7/cdjpeg.c +0 -181
  123. data/src/jpeg-7/cdjpeg.h +0 -187
  124. data/src/jpeg-7/change.log +0 -270
  125. data/src/jpeg-7/cjpeg.1 +0 -325
  126. data/src/jpeg-7/cjpeg.c +0 -616
  127. data/src/jpeg-7/ckconfig.c +0 -402
  128. data/src/jpeg-7/coderules.txt +0 -118
  129. data/src/jpeg-7/config.guess +0 -1561
  130. data/src/jpeg-7/config.sub +0 -1686
  131. data/src/jpeg-7/configure +0 -17139
  132. data/src/jpeg-7/configure.ac +0 -317
  133. data/src/jpeg-7/depcomp +0 -630
  134. data/src/jpeg-7/djpeg.1 +0 -251
  135. data/src/jpeg-7/djpeg.c +0 -617
  136. data/src/jpeg-7/example.c +0 -433
  137. data/src/jpeg-7/filelist.txt +0 -215
  138. data/src/jpeg-7/install-sh +0 -520
  139. data/src/jpeg-7/install.txt +0 -1097
  140. data/src/jpeg-7/jaricom.c +0 -148
  141. data/src/jpeg-7/jcapimin.c +0 -282
  142. data/src/jpeg-7/jcapistd.c +0 -161
  143. data/src/jpeg-7/jcarith.c +0 -921
  144. data/src/jpeg-7/jccoefct.c +0 -453
  145. data/src/jpeg-7/jccolor.c +0 -459
  146. data/src/jpeg-7/jcdctmgr.c +0 -482
  147. data/src/jpeg-7/jchuff.c +0 -1612
  148. data/src/jpeg-7/jcinit.c +0 -65
  149. data/src/jpeg-7/jcmainct.c +0 -293
  150. data/src/jpeg-7/jcmarker.c +0 -667
  151. data/src/jpeg-7/jcmaster.c +0 -770
  152. data/src/jpeg-7/jcomapi.c +0 -106
  153. data/src/jpeg-7/jconfig.bcc +0 -48
  154. data/src/jpeg-7/jconfig.cfg +0 -45
  155. data/src/jpeg-7/jconfig.dj +0 -38
  156. data/src/jpeg-7/jconfig.mac +0 -43
  157. data/src/jpeg-7/jconfig.manx +0 -43
  158. data/src/jpeg-7/jconfig.mc6 +0 -52
  159. data/src/jpeg-7/jconfig.sas +0 -43
  160. data/src/jpeg-7/jconfig.st +0 -42
  161. data/src/jpeg-7/jconfig.txt +0 -155
  162. data/src/jpeg-7/jconfig.vc +0 -45
  163. data/src/jpeg-7/jconfig.vms +0 -37
  164. data/src/jpeg-7/jconfig.wat +0 -38
  165. data/src/jpeg-7/jcparam.c +0 -632
  166. data/src/jpeg-7/jcprepct.c +0 -358
  167. data/src/jpeg-7/jcsample.c +0 -545
  168. data/src/jpeg-7/jctrans.c +0 -381
  169. data/src/jpeg-7/jdapimin.c +0 -396
  170. data/src/jpeg-7/jdapistd.c +0 -275
  171. data/src/jpeg-7/jdarith.c +0 -762
  172. data/src/jpeg-7/jdatadst.c +0 -151
  173. data/src/jpeg-7/jdatasrc.c +0 -212
  174. data/src/jpeg-7/jdcoefct.c +0 -736
  175. data/src/jpeg-7/jdcolor.c +0 -396
  176. data/src/jpeg-7/jdct.h +0 -393
  177. data/src/jpeg-7/jddctmgr.c +0 -382
  178. data/src/jpeg-7/jdhuff.c +0 -1309
  179. data/src/jpeg-7/jdinput.c +0 -384
  180. data/src/jpeg-7/jdmainct.c +0 -512
  181. data/src/jpeg-7/jdmarker.c +0 -1360
  182. data/src/jpeg-7/jdmaster.c +0 -663
  183. data/src/jpeg-7/jdmerge.c +0 -400
  184. data/src/jpeg-7/jdpostct.c +0 -290
  185. data/src/jpeg-7/jdsample.c +0 -361
  186. data/src/jpeg-7/jdtrans.c +0 -136
  187. data/src/jpeg-7/jerror.c +0 -252
  188. data/src/jpeg-7/jerror.h +0 -304
  189. data/src/jpeg-7/jfdctflt.c +0 -174
  190. data/src/jpeg-7/jfdctfst.c +0 -230
  191. data/src/jpeg-7/jfdctint.c +0 -4348
  192. data/src/jpeg-7/jidctflt.c +0 -242
  193. data/src/jpeg-7/jidctfst.c +0 -368
  194. data/src/jpeg-7/jidctint.c +0 -5137
  195. data/src/jpeg-7/jinclude.h +0 -91
  196. data/src/jpeg-7/jmemansi.c +0 -167
  197. data/src/jpeg-7/jmemdos.c +0 -638
  198. data/src/jpeg-7/jmemdosa.asm +0 -379
  199. data/src/jpeg-7/jmemmac.c +0 -289
  200. data/src/jpeg-7/jmemmgr.c +0 -1118
  201. data/src/jpeg-7/jmemname.c +0 -276
  202. data/src/jpeg-7/jmemnobs.c +0 -109
  203. data/src/jpeg-7/jmemsys.h +0 -198
  204. data/src/jpeg-7/jmorecfg.h +0 -369
  205. data/src/jpeg-7/jpegint.h +0 -395
  206. data/src/jpeg-7/jpeglib.h +0 -1135
  207. data/src/jpeg-7/jpegtran.1 +0 -272
  208. data/src/jpeg-7/jpegtran.c +0 -546
  209. data/src/jpeg-7/jquant1.c +0 -856
  210. data/src/jpeg-7/jquant2.c +0 -1310
  211. data/src/jpeg-7/jutils.c +0 -179
  212. data/src/jpeg-7/jversion.h +0 -14
  213. data/src/jpeg-7/libjpeg.map +0 -4
  214. data/src/jpeg-7/libjpeg.txt +0 -3067
  215. data/src/jpeg-7/ltmain.sh +0 -8406
  216. data/src/jpeg-7/makcjpeg.st +0 -36
  217. data/src/jpeg-7/makdjpeg.st +0 -36
  218. data/src/jpeg-7/makeadsw.vc6 +0 -77
  219. data/src/jpeg-7/makeasln.vc9 +0 -33
  220. data/src/jpeg-7/makecdep.vc6 +0 -82
  221. data/src/jpeg-7/makecdsp.vc6 +0 -130
  222. data/src/jpeg-7/makecmak.vc6 +0 -159
  223. data/src/jpeg-7/makecvcp.vc9 +0 -186
  224. data/src/jpeg-7/makeddep.vc6 +0 -82
  225. data/src/jpeg-7/makeddsp.vc6 +0 -130
  226. data/src/jpeg-7/makedmak.vc6 +0 -159
  227. data/src/jpeg-7/makedvcp.vc9 +0 -186
  228. data/src/jpeg-7/makefile.ansi +0 -220
  229. data/src/jpeg-7/makefile.bcc +0 -291
  230. data/src/jpeg-7/makefile.dj +0 -226
  231. data/src/jpeg-7/makefile.manx +0 -220
  232. data/src/jpeg-7/makefile.mc6 +0 -255
  233. data/src/jpeg-7/makefile.mms +0 -224
  234. data/src/jpeg-7/makefile.sas +0 -258
  235. data/src/jpeg-7/makefile.unix +0 -234
  236. data/src/jpeg-7/makefile.vc +0 -217
  237. data/src/jpeg-7/makefile.vms +0 -142
  238. data/src/jpeg-7/makefile.wat +0 -239
  239. data/src/jpeg-7/makejdep.vc6 +0 -423
  240. data/src/jpeg-7/makejdsp.vc6 +0 -285
  241. data/src/jpeg-7/makejdsw.vc6 +0 -29
  242. data/src/jpeg-7/makejmak.vc6 +0 -425
  243. data/src/jpeg-7/makejsln.vc9 +0 -17
  244. data/src/jpeg-7/makejvcp.vc9 +0 -328
  245. data/src/jpeg-7/makeproj.mac +0 -213
  246. data/src/jpeg-7/makerdep.vc6 +0 -6
  247. data/src/jpeg-7/makerdsp.vc6 +0 -78
  248. data/src/jpeg-7/makermak.vc6 +0 -110
  249. data/src/jpeg-7/makervcp.vc9 +0 -133
  250. data/src/jpeg-7/maketdep.vc6 +0 -43
  251. data/src/jpeg-7/maketdsp.vc6 +0 -122
  252. data/src/jpeg-7/maketmak.vc6 +0 -131
  253. data/src/jpeg-7/maketvcp.vc9 +0 -178
  254. data/src/jpeg-7/makewdep.vc6 +0 -6
  255. data/src/jpeg-7/makewdsp.vc6 +0 -78
  256. data/src/jpeg-7/makewmak.vc6 +0 -110
  257. data/src/jpeg-7/makewvcp.vc9 +0 -133
  258. data/src/jpeg-7/makljpeg.st +0 -68
  259. data/src/jpeg-7/maktjpeg.st +0 -30
  260. data/src/jpeg-7/makvms.opt +0 -4
  261. data/src/jpeg-7/missing +0 -376
  262. data/src/jpeg-7/rdbmp.c +0 -439
  263. data/src/jpeg-7/rdcolmap.c +0 -253
  264. data/src/jpeg-7/rdgif.c +0 -38
  265. data/src/jpeg-7/rdjpgcom.1 +0 -63
  266. data/src/jpeg-7/rdjpgcom.c +0 -515
  267. data/src/jpeg-7/rdppm.c +0 -459
  268. data/src/jpeg-7/rdrle.c +0 -387
  269. data/src/jpeg-7/rdswitch.c +0 -365
  270. data/src/jpeg-7/rdtarga.c +0 -500
  271. data/src/jpeg-7/structure.txt +0 -945
  272. data/src/jpeg-7/testimg.bmp +0 -0
  273. data/src/jpeg-7/testimg.jpg +0 -0
  274. data/src/jpeg-7/testimg.ppm +0 -4
  275. data/src/jpeg-7/testimgp.jpg +0 -0
  276. data/src/jpeg-7/testorig.jpg +0 -0
  277. data/src/jpeg-7/testprog.jpg +0 -0
  278. data/src/jpeg-7/transupp.c +0 -1533
  279. data/src/jpeg-7/transupp.h +0 -205
  280. data/src/jpeg-7/usage.txt +0 -605
  281. data/src/jpeg-7/wizard.txt +0 -211
  282. data/src/jpeg-7/wrbmp.c +0 -442
  283. data/src/jpeg-7/wrgif.c +0 -399
  284. data/src/jpeg-7/wrjpgcom.1 +0 -103
  285. data/src/jpeg-7/wrjpgcom.c +0 -583
  286. data/src/jpeg-7/wrppm.c +0 -269
  287. data/src/jpeg-7/wrrle.c +0 -305
  288. data/src/jpeg-7/wrtarga.c +0 -253
@@ -1,272 +0,0 @@
1
- .TH JPEGTRAN 1 "28 March 2009"
2
- .SH NAME
3
- jpegtran \- lossless transformation of JPEG files
4
- .SH SYNOPSIS
5
- .B jpegtran
6
- [
7
- .I options
8
- ]
9
- [
10
- .I filename
11
- ]
12
- .LP
13
- .SH DESCRIPTION
14
- .LP
15
- .B jpegtran
16
- performs various useful transformations of JPEG files.
17
- It can translate the coded representation from one variant of JPEG to another,
18
- for example from baseline JPEG to progressive JPEG or vice versa. It can also
19
- perform some rearrangements of the image data, for example turning an image
20
- from landscape to portrait format by rotation.
21
- .PP
22
- .B jpegtran
23
- works by rearranging the compressed data (DCT coefficients), without
24
- ever fully decoding the image. Therefore, its transformations are lossless:
25
- there is no image degradation at all, which would not be true if you used
26
- .B djpeg
27
- followed by
28
- .B cjpeg
29
- to accomplish the same conversion. But by the same token,
30
- .B jpegtran
31
- cannot perform lossy operations such as changing the image quality.
32
- .PP
33
- .B jpegtran
34
- reads the named JPEG/JFIF file, or the standard input if no file is
35
- named, and produces a JPEG/JFIF file on the standard output.
36
- .SH OPTIONS
37
- All switch names may be abbreviated; for example,
38
- .B \-optimize
39
- may be written
40
- .B \-opt
41
- or
42
- .BR \-o .
43
- Upper and lower case are equivalent.
44
- British spellings are also accepted (e.g.,
45
- .BR \-optimise ),
46
- though for brevity these are not mentioned below.
47
- .PP
48
- To specify the coded JPEG representation used in the output file,
49
- .B jpegtran
50
- accepts a subset of the switches recognized by
51
- .BR cjpeg :
52
- .TP
53
- .B \-optimize
54
- Perform optimization of entropy encoding parameters.
55
- .TP
56
- .B \-progressive
57
- Create progressive JPEG file.
58
- .TP
59
- .BI \-restart " N"
60
- Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
61
- attached to the number.
62
- .TP
63
- .B \-arithmetic
64
- Use arithmetic coding.
65
- .TP
66
- .BI \-scans " file"
67
- Use the scan script given in the specified text file.
68
- .PP
69
- See
70
- .BR cjpeg (1)
71
- for more details about these switches.
72
- If you specify none of these switches, you get a plain baseline-JPEG output
73
- file. The quality setting and so forth are determined by the input file.
74
- .PP
75
- The image can be losslessly transformed by giving one of these switches:
76
- .TP
77
- .B \-flip horizontal
78
- Mirror image horizontally (left-right).
79
- .TP
80
- .B \-flip vertical
81
- Mirror image vertically (top-bottom).
82
- .TP
83
- .B \-rotate 90
84
- Rotate image 90 degrees clockwise.
85
- .TP
86
- .B \-rotate 180
87
- Rotate image 180 degrees.
88
- .TP
89
- .B \-rotate 270
90
- Rotate image 270 degrees clockwise (or 90 ccw).
91
- .TP
92
- .B \-transpose
93
- Transpose image (across UL-to-LR axis).
94
- .TP
95
- .B \-transverse
96
- Transverse transpose (across UR-to-LL axis).
97
- .IP
98
- The transpose transformation has no restrictions regarding image dimensions.
99
- The other transformations operate rather oddly if the image dimensions are not
100
- a multiple of the iMCU size (usually 8 or 16 pixels), because they can only
101
- transform complete blocks of DCT coefficient data in the desired way.
102
- .IP
103
- .BR jpegtran 's
104
- default behavior when transforming an odd-size image is designed
105
- to preserve exact reversibility and mathematical consistency of the
106
- transformation set. As stated, transpose is able to flip the entire image
107
- area. Horizontal mirroring leaves any partial iMCU column at the right edge
108
- untouched, but is able to flip all rows of the image. Similarly, vertical
109
- mirroring leaves any partial iMCU row at the bottom edge untouched, but is
110
- able to flip all columns. The other transforms can be built up as sequences
111
- of transpose and flip operations; for consistency, their actions on edge
112
- pixels are defined to be the same as the end result of the corresponding
113
- transpose-and-flip sequence.
114
- .IP
115
- For practical use, you may prefer to discard any untransformable edge pixels
116
- rather than having a strange-looking strip along the right and/or bottom edges
117
- of a transformed image. To do this, add the
118
- .B \-trim
119
- switch:
120
- .TP
121
- .B \-trim
122
- Drop non-transformable edge blocks.
123
- .IP
124
- Obviously, a transformation with
125
- .B \-trim
126
- is not reversible, so strictly speaking
127
- .B jpegtran
128
- with this switch is not lossless. Also, the expected mathematical
129
- equivalences between the transformations no longer hold. For example,
130
- .B \-rot 270 -trim
131
- trims only the bottom edge, but
132
- .B \-rot 90 -trim
133
- followed by
134
- .B \-rot 180 -trim
135
- trims both edges.
136
- .IP
137
- If you are only interested in perfect transformation, add the
138
- .B \-perfect
139
- switch:
140
- .TP
141
- .B \-perfect
142
- Fails with an error if the transformation is not perfect.
143
- .IP
144
- For example you may want to do
145
- .IP
146
- .B (jpegtran \-rot 90 -perfect
147
- .I foo.jpg
148
- .B || djpeg
149
- .I foo.jpg
150
- .B | pnmflip \-r90 | cjpeg)
151
- .IP
152
- to do a perfect rotation if available or an approximated one if not.
153
- .PP
154
- We also offer a lossless-crop option, which discards data outside a given
155
- image region but losslessly preserves what is inside. Like the rotate and
156
- flip transforms, lossless crop is restricted by the current JPEG format: the
157
- upper left corner of the selected region must fall on an iMCU boundary. If
158
- this does not hold for the given crop parameters, we silently move the upper
159
- left corner up and/or left to make it so, simultaneously increasing the region
160
- dimensions to keep the lower right crop corner unchanged. (Thus, the output
161
- image covers at least the requested region, but may cover more.)
162
-
163
- The image can be losslessly cropped by giving the switch:
164
- .TP
165
- .B \-crop WxH+X+Y
166
- Crop to a rectangular subarea of width W, height H starting at point X,Y.
167
- .PP
168
- Another not-strictly-lossless transformation switch is:
169
- .TP
170
- .B \-grayscale
171
- Force grayscale output.
172
- .IP
173
- This option discards the chrominance channels if the input image is YCbCr
174
- (ie, a standard color JPEG), resulting in a grayscale JPEG file. The
175
- luminance channel is preserved exactly, so this is a better method of reducing
176
- to grayscale than decompression, conversion, and recompression. This switch
177
- is particularly handy for fixing a monochrome picture that was mistakenly
178
- encoded as a color JPEG. (In such a case, the space savings from getting rid
179
- of the near-empty chroma channels won't be large; but the decoding time for
180
- a grayscale JPEG is substantially less than that for a color JPEG.)
181
- .PP
182
- .B jpegtran
183
- also recognizes these switches that control what to do with "extra" markers,
184
- such as comment blocks:
185
- .TP
186
- .B \-copy none
187
- Copy no extra markers from source file. This setting suppresses all
188
- comments and other excess baggage present in the source file.
189
- .TP
190
- .B \-copy comments
191
- Copy only comment markers. This setting copies comments from the source file,
192
- but discards any other inessential (for image display) data.
193
- .TP
194
- .B \-copy all
195
- Copy all extra markers. This setting preserves miscellaneous markers
196
- found in the source file, such as JFIF thumbnails, Exif data, and Photoshop
197
- settings. In some files these extra markers can be sizable.
198
- .IP
199
- The default behavior is
200
- .BR "\-copy comments" .
201
- (Note: in IJG releases v6 and v6a,
202
- .B jpegtran
203
- always did the equivalent of
204
- .BR "\-copy none" .)
205
- .PP
206
- Additional switches recognized by jpegtran are:
207
- .TP
208
- .BI \-maxmemory " N"
209
- Set limit for amount of memory to use in processing large images. Value is
210
- in thousands of bytes, or millions of bytes if "M" is attached to the
211
- number. For example,
212
- .B \-max 4m
213
- selects 4000000 bytes. If more space is needed, temporary files will be used.
214
- .TP
215
- .BI \-outfile " name"
216
- Send output image to the named file, not to standard output.
217
- .TP
218
- .B \-verbose
219
- Enable debug printout. More
220
- .BR \-v 's
221
- give more output. Also, version information is printed at startup.
222
- .TP
223
- .B \-debug
224
- Same as
225
- .BR \-verbose .
226
- .SH EXAMPLES
227
- .LP
228
- This example converts a baseline JPEG file to progressive form:
229
- .IP
230
- .B jpegtran \-progressive
231
- .I foo.jpg
232
- .B >
233
- .I fooprog.jpg
234
- .PP
235
- This example rotates an image 90 degrees clockwise, discarding any
236
- unrotatable edge pixels:
237
- .IP
238
- .B jpegtran \-rot 90 -trim
239
- .I foo.jpg
240
- .B >
241
- .I foo90.jpg
242
- .SH ENVIRONMENT
243
- .TP
244
- .B JPEGMEM
245
- If this environment variable is set, its value is the default memory limit.
246
- The value is specified as described for the
247
- .B \-maxmemory
248
- switch.
249
- .B JPEGMEM
250
- overrides the default value specified when the program was compiled, and
251
- itself is overridden by an explicit
252
- .BR \-maxmemory .
253
- .SH SEE ALSO
254
- .BR cjpeg (1),
255
- .BR djpeg (1),
256
- .BR rdjpgcom (1),
257
- .BR wrjpgcom (1)
258
- .br
259
- Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
260
- Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
261
- .SH AUTHOR
262
- Independent JPEG Group
263
- .SH BUGS
264
- The transform options can't transform odd-size images perfectly. Use
265
- .B \-trim
266
- or
267
- .B \-perfect
268
- if you don't like the results.
269
- .PP
270
- The entire image is read into memory and then written out again, even in
271
- cases where this isn't really necessary. Expect swapping on large images,
272
- especially when using the more complex transform options.
@@ -1,546 +0,0 @@
1
- /*
2
- * jpegtran.c
3
- *
4
- * Copyright (C) 1995-2001, Thomas G. Lane.
5
- * This file is part of the Independent JPEG Group's software.
6
- * For conditions of distribution and use, see the accompanying README file.
7
- *
8
- * This file contains a command-line user interface for JPEG transcoding.
9
- * It is very similar to cjpeg.c, but provides lossless transcoding between
10
- * different JPEG file formats. It also provides some lossless and sort-of-
11
- * lossless transformations of JPEG data.
12
- */
13
-
14
- #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
15
- #include "transupp.h" /* Support routines for jpegtran */
16
- #include "jversion.h" /* for version message */
17
-
18
- #ifdef USE_CCOMMAND /* command-line reader for Macintosh */
19
- #ifdef __MWERKS__
20
- #include <SIOUX.h> /* Metrowerks needs this */
21
- #include <console.h> /* ... and this */
22
- #endif
23
- #ifdef THINK_C
24
- #include <console.h> /* Think declares it here */
25
- #endif
26
- #endif
27
-
28
-
29
- /*
30
- * Argument-parsing code.
31
- * The switch parser is designed to be useful with DOS-style command line
32
- * syntax, ie, intermixed switches and file names, where only the switches
33
- * to the left of a given file name affect processing of that file.
34
- * The main program in this file doesn't actually use this capability...
35
- */
36
-
37
-
38
- static const char * progname; /* program name for error messages */
39
- static char * outfilename; /* for -outfile switch */
40
- static JCOPY_OPTION copyoption; /* -copy switch */
41
- static jpeg_transform_info transformoption; /* image transformation options */
42
-
43
-
44
- LOCAL(void)
45
- usage (void)
46
- /* complain about bad command line */
47
- {
48
- fprintf(stderr, "usage: %s [switches] ", progname);
49
- #ifdef TWO_FILE_COMMANDLINE
50
- fprintf(stderr, "inputfile outputfile\n");
51
- #else
52
- fprintf(stderr, "[inputfile]\n");
53
- #endif
54
-
55
- fprintf(stderr, "Switches (names may be abbreviated):\n");
56
- fprintf(stderr, " -copy none Copy no extra markers from source file\n");
57
- fprintf(stderr, " -copy comments Copy only comment markers (default)\n");
58
- fprintf(stderr, " -copy all Copy all extra markers\n");
59
- #ifdef ENTROPY_OPT_SUPPORTED
60
- fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n");
61
- #endif
62
- #ifdef C_PROGRESSIVE_SUPPORTED
63
- fprintf(stderr, " -progressive Create progressive JPEG file\n");
64
- #endif
65
- #if TRANSFORMS_SUPPORTED
66
- fprintf(stderr, "Switches for modifying the image:\n");
67
- fprintf(stderr, " -crop WxH+X+Y Crop to a rectangular subarea\n");
68
- fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n");
69
- fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n");
70
- fprintf(stderr, " -perfect Fail if there is non-transformable edge blocks\n");
71
- fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n");
72
- fprintf(stderr, " -transpose Transpose image\n");
73
- fprintf(stderr, " -transverse Transverse transpose image\n");
74
- fprintf(stderr, " -trim Drop non-transformable edge blocks\n");
75
- #endif /* TRANSFORMS_SUPPORTED */
76
- fprintf(stderr, "Switches for advanced users:\n");
77
- fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
78
- fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n");
79
- fprintf(stderr, " -outfile name Specify name for output file\n");
80
- fprintf(stderr, " -verbose or -debug Emit debug output\n");
81
- fprintf(stderr, "Switches for wizards:\n");
82
- #ifdef C_ARITH_CODING_SUPPORTED
83
- fprintf(stderr, " -arithmetic Use arithmetic coding\n");
84
- #endif
85
- #ifdef C_MULTISCAN_FILES_SUPPORTED
86
- fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
87
- #endif
88
- exit(EXIT_FAILURE);
89
- }
90
-
91
-
92
- LOCAL(void)
93
- select_transform (JXFORM_CODE transform)
94
- /* Silly little routine to detect multiple transform options,
95
- * which we can't handle.
96
- */
97
- {
98
- #if TRANSFORMS_SUPPORTED
99
- if (transformoption.transform == JXFORM_NONE ||
100
- transformoption.transform == transform) {
101
- transformoption.transform = transform;
102
- } else {
103
- fprintf(stderr, "%s: can only do one image transformation at a time\n",
104
- progname);
105
- usage();
106
- }
107
- #else
108
- fprintf(stderr, "%s: sorry, image transformation was not compiled\n",
109
- progname);
110
- exit(EXIT_FAILURE);
111
- #endif
112
- }
113
-
114
-
115
- LOCAL(int)
116
- parse_switches (j_compress_ptr cinfo, int argc, char **argv,
117
- int last_file_arg_seen, boolean for_real)
118
- /* Parse optional switches.
119
- * Returns argv[] index of first file-name argument (== argc if none).
120
- * Any file names with indexes <= last_file_arg_seen are ignored;
121
- * they have presumably been processed in a previous iteration.
122
- * (Pass 0 for last_file_arg_seen on the first or only iteration.)
123
- * for_real is FALSE on the first (dummy) pass; we may skip any expensive
124
- * processing.
125
- */
126
- {
127
- int argn;
128
- char * arg;
129
- boolean simple_progressive;
130
- char * scansarg = NULL; /* saves -scans parm if any */
131
-
132
- /* Set up default JPEG parameters. */
133
- simple_progressive = FALSE;
134
- outfilename = NULL;
135
- copyoption = JCOPYOPT_DEFAULT;
136
- transformoption.transform = JXFORM_NONE;
137
- transformoption.trim = FALSE;
138
- transformoption.perfect = FALSE;
139
- transformoption.force_grayscale = FALSE;
140
- transformoption.crop = FALSE;
141
- cinfo->err->trace_level = 0;
142
-
143
- /* Scan command line options, adjust parameters */
144
-
145
- for (argn = 1; argn < argc; argn++) {
146
- arg = argv[argn];
147
- if (*arg != '-') {
148
- /* Not a switch, must be a file name argument */
149
- if (argn <= last_file_arg_seen) {
150
- outfilename = NULL; /* -outfile applies to just one input file */
151
- continue; /* ignore this name if previously processed */
152
- }
153
- break; /* else done parsing switches */
154
- }
155
- arg++; /* advance past switch marker character */
156
-
157
- if (keymatch(arg, "arithmetic", 1)) {
158
- /* Use arithmetic coding. */
159
- #ifdef C_ARITH_CODING_SUPPORTED
160
- cinfo->arith_code = TRUE;
161
- #else
162
- fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
163
- progname);
164
- exit(EXIT_FAILURE);
165
- #endif
166
-
167
- } else if (keymatch(arg, "copy", 2)) {
168
- /* Select which extra markers to copy. */
169
- if (++argn >= argc) /* advance to next argument */
170
- usage();
171
- if (keymatch(argv[argn], "none", 1)) {
172
- copyoption = JCOPYOPT_NONE;
173
- } else if (keymatch(argv[argn], "comments", 1)) {
174
- copyoption = JCOPYOPT_COMMENTS;
175
- } else if (keymatch(argv[argn], "all", 1)) {
176
- copyoption = JCOPYOPT_ALL;
177
- } else
178
- usage();
179
-
180
- } else if (keymatch(arg, "crop", 2)) {
181
- /* Perform lossless cropping. */
182
- #if TRANSFORMS_SUPPORTED
183
- if (++argn >= argc) /* advance to next argument */
184
- usage();
185
- if (! jtransform_parse_crop_spec(&transformoption, argv[argn])) {
186
- fprintf(stderr, "%s: bogus -crop argument '%s'\n",
187
- progname, argv[argn]);
188
- exit(EXIT_FAILURE);
189
- }
190
- #else
191
- select_transform(JXFORM_NONE); /* force an error */
192
- #endif
193
-
194
- } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
195
- /* Enable debug printouts. */
196
- /* On first -d, print version identification */
197
- static boolean printed_version = FALSE;
198
-
199
- if (! printed_version) {
200
- fprintf(stderr, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n",
201
- JVERSION, JCOPYRIGHT);
202
- printed_version = TRUE;
203
- }
204
- cinfo->err->trace_level++;
205
-
206
- } else if (keymatch(arg, "flip", 1)) {
207
- /* Mirror left-right or top-bottom. */
208
- if (++argn >= argc) /* advance to next argument */
209
- usage();
210
- if (keymatch(argv[argn], "horizontal", 1))
211
- select_transform(JXFORM_FLIP_H);
212
- else if (keymatch(argv[argn], "vertical", 1))
213
- select_transform(JXFORM_FLIP_V);
214
- else
215
- usage();
216
-
217
- } else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) {
218
- /* Force to grayscale. */
219
- #if TRANSFORMS_SUPPORTED
220
- transformoption.force_grayscale = TRUE;
221
- #else
222
- select_transform(JXFORM_NONE); /* force an error */
223
- #endif
224
-
225
- } else if (keymatch(arg, "maxmemory", 3)) {
226
- /* Maximum memory in Kb (or Mb with 'm'). */
227
- long lval;
228
- char ch = 'x';
229
-
230
- if (++argn >= argc) /* advance to next argument */
231
- usage();
232
- if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
233
- usage();
234
- if (ch == 'm' || ch == 'M')
235
- lval *= 1000L;
236
- cinfo->mem->max_memory_to_use = lval * 1000L;
237
-
238
- } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
239
- /* Enable entropy parm optimization. */
240
- #ifdef ENTROPY_OPT_SUPPORTED
241
- cinfo->optimize_coding = TRUE;
242
- #else
243
- fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n",
244
- progname);
245
- exit(EXIT_FAILURE);
246
- #endif
247
-
248
- } else if (keymatch(arg, "outfile", 4)) {
249
- /* Set output file name. */
250
- if (++argn >= argc) /* advance to next argument */
251
- usage();
252
- outfilename = argv[argn]; /* save it away for later use */
253
-
254
- } else if (keymatch(arg, "perfect", 2)) {
255
- /* Fail if there is any partial edge MCUs that the transform can't
256
- * handle. */
257
- transformoption.perfect = TRUE;
258
-
259
- } else if (keymatch(arg, "progressive", 2)) {
260
- /* Select simple progressive mode. */
261
- #ifdef C_PROGRESSIVE_SUPPORTED
262
- simple_progressive = TRUE;
263
- /* We must postpone execution until num_components is known. */
264
- #else
265
- fprintf(stderr, "%s: sorry, progressive output was not compiled\n",
266
- progname);
267
- exit(EXIT_FAILURE);
268
- #endif
269
-
270
- } else if (keymatch(arg, "restart", 1)) {
271
- /* Restart interval in MCU rows (or in MCUs with 'b'). */
272
- long lval;
273
- char ch = 'x';
274
-
275
- if (++argn >= argc) /* advance to next argument */
276
- usage();
277
- if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
278
- usage();
279
- if (lval < 0 || lval > 65535L)
280
- usage();
281
- if (ch == 'b' || ch == 'B') {
282
- cinfo->restart_interval = (unsigned int) lval;
283
- cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
284
- } else {
285
- cinfo->restart_in_rows = (int) lval;
286
- /* restart_interval will be computed during startup */
287
- }
288
-
289
- } else if (keymatch(arg, "rotate", 2)) {
290
- /* Rotate 90, 180, or 270 degrees (measured clockwise). */
291
- if (++argn >= argc) /* advance to next argument */
292
- usage();
293
- if (keymatch(argv[argn], "90", 2))
294
- select_transform(JXFORM_ROT_90);
295
- else if (keymatch(argv[argn], "180", 3))
296
- select_transform(JXFORM_ROT_180);
297
- else if (keymatch(argv[argn], "270", 3))
298
- select_transform(JXFORM_ROT_270);
299
- else
300
- usage();
301
-
302
- } else if (keymatch(arg, "scans", 1)) {
303
- /* Set scan script. */
304
- #ifdef C_MULTISCAN_FILES_SUPPORTED
305
- if (++argn >= argc) /* advance to next argument */
306
- usage();
307
- scansarg = argv[argn];
308
- /* We must postpone reading the file in case -progressive appears. */
309
- #else
310
- fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n",
311
- progname);
312
- exit(EXIT_FAILURE);
313
- #endif
314
-
315
- } else if (keymatch(arg, "transpose", 1)) {
316
- /* Transpose (across UL-to-LR axis). */
317
- select_transform(JXFORM_TRANSPOSE);
318
-
319
- } else if (keymatch(arg, "transverse", 6)) {
320
- /* Transverse transpose (across UR-to-LL axis). */
321
- select_transform(JXFORM_TRANSVERSE);
322
-
323
- } else if (keymatch(arg, "trim", 3)) {
324
- /* Trim off any partial edge MCUs that the transform can't handle. */
325
- transformoption.trim = TRUE;
326
-
327
- } else {
328
- usage(); /* bogus switch */
329
- }
330
- }
331
-
332
- /* Post-switch-scanning cleanup */
333
-
334
- if (for_real) {
335
-
336
- #ifdef C_PROGRESSIVE_SUPPORTED
337
- if (simple_progressive) /* process -progressive; -scans can override */
338
- jpeg_simple_progression(cinfo);
339
- #endif
340
-
341
- #ifdef C_MULTISCAN_FILES_SUPPORTED
342
- if (scansarg != NULL) /* process -scans if it was present */
343
- if (! read_scan_script(cinfo, scansarg))
344
- usage();
345
- #endif
346
- }
347
-
348
- return argn; /* return index of next arg (file name) */
349
- }
350
-
351
-
352
- /*
353
- * The main program.
354
- */
355
-
356
- int
357
- main (int argc, char **argv)
358
- {
359
- struct jpeg_decompress_struct srcinfo;
360
- struct jpeg_compress_struct dstinfo;
361
- struct jpeg_error_mgr jsrcerr, jdsterr;
362
- #ifdef PROGRESS_REPORT
363
- struct cdjpeg_progress_mgr progress;
364
- #endif
365
- jvirt_barray_ptr * src_coef_arrays;
366
- jvirt_barray_ptr * dst_coef_arrays;
367
- int file_index;
368
- /* We assume all-in-memory processing and can therefore use only a
369
- * single file pointer for sequential input and output operation.
370
- */
371
- FILE * fp;
372
-
373
- /* On Mac, fetch a command line. */
374
- #ifdef USE_CCOMMAND
375
- argc = ccommand(&argv);
376
- #endif
377
-
378
- progname = argv[0];
379
- if (progname == NULL || progname[0] == 0)
380
- progname = "jpegtran"; /* in case C library doesn't provide it */
381
-
382
- /* Initialize the JPEG decompression object with default error handling. */
383
- srcinfo.err = jpeg_std_error(&jsrcerr);
384
- jpeg_create_decompress(&srcinfo);
385
- /* Initialize the JPEG compression object with default error handling. */
386
- dstinfo.err = jpeg_std_error(&jdsterr);
387
- jpeg_create_compress(&dstinfo);
388
-
389
- /* Now safe to enable signal catcher.
390
- * Note: we assume only the decompression object will have virtual arrays.
391
- */
392
- #ifdef NEED_SIGNAL_CATCHER
393
- enable_signal_catcher((j_common_ptr) &srcinfo);
394
- #endif
395
-
396
- /* Scan command line to find file names.
397
- * It is convenient to use just one switch-parsing routine, but the switch
398
- * values read here are mostly ignored; we will rescan the switches after
399
- * opening the input file. Also note that most of the switches affect the
400
- * destination JPEG object, so we parse into that and then copy over what
401
- * needs to affects the source too.
402
- */
403
-
404
- file_index = parse_switches(&dstinfo, argc, argv, 0, FALSE);
405
- jsrcerr.trace_level = jdsterr.trace_level;
406
- srcinfo.mem->max_memory_to_use = dstinfo.mem->max_memory_to_use;
407
-
408
- #ifdef TWO_FILE_COMMANDLINE
409
- /* Must have either -outfile switch or explicit output file name */
410
- if (outfilename == NULL) {
411
- if (file_index != argc-2) {
412
- fprintf(stderr, "%s: must name one input and one output file\n",
413
- progname);
414
- usage();
415
- }
416
- outfilename = argv[file_index+1];
417
- } else {
418
- if (file_index != argc-1) {
419
- fprintf(stderr, "%s: must name one input and one output file\n",
420
- progname);
421
- usage();
422
- }
423
- }
424
- #else
425
- /* Unix style: expect zero or one file name */
426
- if (file_index < argc-1) {
427
- fprintf(stderr, "%s: only one input file\n", progname);
428
- usage();
429
- }
430
- #endif /* TWO_FILE_COMMANDLINE */
431
-
432
- /* Open the input file. */
433
- if (file_index < argc) {
434
- if ((fp = fopen(argv[file_index], READ_BINARY)) == NULL) {
435
- fprintf(stderr, "%s: can't open %s for reading\n", progname, argv[file_index]);
436
- exit(EXIT_FAILURE);
437
- }
438
- } else {
439
- /* default input file is stdin */
440
- fp = read_stdin();
441
- }
442
-
443
- #ifdef PROGRESS_REPORT
444
- start_progress_monitor((j_common_ptr) &dstinfo, &progress);
445
- #endif
446
-
447
- /* Specify data source for decompression */
448
- jpeg_stdio_src(&srcinfo, fp);
449
-
450
- /* Enable saving of extra markers that we want to copy */
451
- jcopy_markers_setup(&srcinfo, copyoption);
452
-
453
- /* Read file header */
454
- (void) jpeg_read_header(&srcinfo, TRUE);
455
-
456
- /* Any space needed by a transform option must be requested before
457
- * jpeg_read_coefficients so that memory allocation will be done right.
458
- */
459
- #if TRANSFORMS_SUPPORTED
460
- /* Fails right away if -perfect is given and transformation is not perfect.
461
- */
462
- if (transformoption.perfect &&
463
- !jtransform_perfect_transform(srcinfo.image_width, srcinfo.image_height,
464
- srcinfo.max_h_samp_factor * DCTSIZE, srcinfo.max_v_samp_factor * DCTSIZE,
465
- transformoption.transform)) {
466
- fprintf(stderr, "%s: transformation is not perfect\n", progname);
467
- exit(EXIT_FAILURE);
468
- }
469
- jtransform_request_workspace(&srcinfo, &transformoption);
470
- #endif
471
-
472
- /* Read source file as DCT coefficients */
473
- src_coef_arrays = jpeg_read_coefficients(&srcinfo);
474
-
475
- /* Initialize destination compression parameters from source values */
476
- jpeg_copy_critical_parameters(&srcinfo, &dstinfo);
477
-
478
- /* Adjust destination parameters if required by transform options;
479
- * also find out which set of coefficient arrays will hold the output.
480
- */
481
- #if TRANSFORMS_SUPPORTED
482
- dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &dstinfo,
483
- src_coef_arrays,
484
- &transformoption);
485
- #else
486
- dst_coef_arrays = src_coef_arrays;
487
- #endif
488
-
489
- /* Close input file, if we opened it.
490
- * Note: we assume that jpeg_read_coefficients consumed all input
491
- * until JPEG_REACHED_EOI, and that jpeg_finish_decompress will
492
- * only consume more while (! cinfo->inputctl->eoi_reached).
493
- * We cannot call jpeg_finish_decompress here since we still need the
494
- * virtual arrays allocated from the source object for processing.
495
- */
496
- if (fp != stdin)
497
- fclose(fp);
498
-
499
- /* Open the output file. */
500
- if (outfilename != NULL) {
501
- if ((fp = fopen(outfilename, WRITE_BINARY)) == NULL) {
502
- fprintf(stderr, "%s: can't open %s for writing\n", progname, outfilename);
503
- exit(EXIT_FAILURE);
504
- }
505
- } else {
506
- /* default output file is stdout */
507
- fp = write_stdout();
508
- }
509
-
510
- /* Adjust default compression parameters by re-parsing the options */
511
- file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE);
512
-
513
- /* Specify data destination for compression */
514
- jpeg_stdio_dest(&dstinfo, fp);
515
-
516
- /* Start compressor (note no image data is actually written here) */
517
- jpeg_write_coefficients(&dstinfo, dst_coef_arrays);
518
-
519
- /* Copy to the output file any extra markers that we want to preserve */
520
- jcopy_markers_execute(&srcinfo, &dstinfo, copyoption);
521
-
522
- /* Execute image transformation, if any */
523
- #if TRANSFORMS_SUPPORTED
524
- jtransform_execute_transformation(&srcinfo, &dstinfo,
525
- src_coef_arrays,
526
- &transformoption);
527
- #endif
528
-
529
- /* Finish compression and release memory */
530
- jpeg_finish_compress(&dstinfo);
531
- jpeg_destroy_compress(&dstinfo);
532
- (void) jpeg_finish_decompress(&srcinfo);
533
- jpeg_destroy_decompress(&srcinfo);
534
-
535
- /* Close output file, if we opened it */
536
- if (fp != stdout)
537
- fclose(fp);
538
-
539
- #ifdef PROGRESS_REPORT
540
- end_progress_monitor((j_common_ptr) &dstinfo);
541
- #endif
542
-
543
- /* All done. */
544
- exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS);
545
- return 0; /* suppress no-return-value warnings */
546
- }