TurboJPEG: ICC profile support

This commit is contained in:
DRC
2024-09-03 07:54:17 -04:00
parent c6de7d87ad
commit a272858212
42 changed files with 1336 additions and 375 deletions

View File

@@ -528,7 +528,7 @@ final class TJBench {
byte[][] jpegBufs = null;
byte[] srcBuf;
int[] jpegSizes = null;
int totalJpegSize;
int iccSize = 0, totalJpegSize;
double start, elapsed;
int ps = TJ.getPixelSize(pf), tile, x, y, iter;
// Original image
@@ -571,6 +571,8 @@ final class TJBench {
System.out.println("JPEG image is progressive\n");
if (tjt.get(TJ.PARAM_ARITHMETIC) == 1)
System.out.println("JPEG image uses arithmetic entropy coding\n");
if ((xformOpt & TJTransform.OPT_COPYNONE) == 0)
iccSize = tjt.getICCSize();
tjt.set(TJ.PARAM_PROGRESSIVE, progressive ? 1 : 0);
tjt.set(TJ.PARAM_ARITHMETIC, arithmetic ? 1 : 0);
@@ -687,7 +689,8 @@ final class TJBench {
t[tile].cf = customFilter;
if ((t[tile].options & TJTransform.OPT_NOOUTPUT) == 0)
jpegBufs[tile] =
new byte[TJ.bufSize(t[tile].width, t[tile].height, tsubsamp)];
new byte[TJ.bufSize(t[tile].width, t[tile].height, tsubsamp) +
iccSize];
}
}
@@ -736,7 +739,7 @@ final class TJBench {
} else {
if (quiet == 1)
System.out.print("N/A N/A ");
jpegBufs = new byte[1][TJ.bufSize(ttilew, ttileh, tsubsamp)];
jpegBufs = new byte[1][TJ.bufSize(ttilew, ttileh, tsubsamp) + iccSize];
jpegSizes = new int[1];
jpegBufs[0] = srcBuf;
jpegSizes[0] = srcSize;

View File

@@ -35,7 +35,6 @@
* - GIF and Targa input file formats [legacy feature]
* - Separate quality settings for luminance and chrominance
* - The floating-point DCT method [legacy feature]
* - Embedding an ICC color management profile
* - Input image smoothing
* - Progress reporting
* - Debug output
@@ -75,6 +74,9 @@ final class TJComp {
System.out.println("GENERAL OPTIONS (CAN BE ABBREVIATED)");
System.out.println("------------------------------------");
System.out.println("-icc FILE");
System.out.println(" Embed the ICC (International Color Consortium) color management profile");
System.out.println(" from the specified file into the JPEG image");
System.out.println("-lossless PSV[,Pt]");
System.out.println(" Create a lossless JPEG image (implies -subsamp 444) using predictor");
System.out.println(" selection value PSV (1-7) and optional point transform Pt (0 through");
@@ -136,6 +138,7 @@ final class TJComp {
public static void main(String[] argv) {
int exitStatus = 0;
TJCompressor tjc = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try {
@@ -145,7 +148,8 @@ final class TJComp {
pixelFormat = TJ.PF_UNKNOWN, precision = -1, progressive = -1,
quality = DEFAULT_QUALITY, restartIntervalBlocks = -1,
restartIntervalRows = -1, subsamp = DEFAULT_SUBSAMP;
byte[] jpegBuf;
String iccFilename = null;
byte[] iccBuf, jpegBuf;
for (i = 0; i < argv.length; i++) {
if (matchArg(argv[i], "-arithmetic", 2))
@@ -159,6 +163,8 @@ final class TJComp {
} else if (matchArg(argv[i], "-grayscale", 2) ||
matchArg(argv[i], "-greyscale", 2))
colorspace = TJ.CS_GRAY;
else if (matchArg(argv[i], "-icc", 2) && i < argv.length - 1)
iccFilename = argv[++i];
else if (matchArg(argv[i], "-lossless", 2) && i < argv.length - 1) {
Scanner scanner = new Scanner(argv[++i]).useDelimiter(",");
@@ -280,6 +286,18 @@ final class TJComp {
if (colorspace >= 0)
tjc.set(TJ.PARAM_COLORSPACE, colorspace);
if (iccFilename != null) {
File iccFile = new File(iccFilename);
fis = new FileInputStream(iccFile);
int iccSize = fis.available();
if (iccSize < 1)
throw new Exception("ICC profile contains no data");
iccBuf = new byte[iccSize];
fis.read(iccBuf);
fis.close(); fis = null;
tjc.setICCProfile(iccBuf);
}
jpegBuf = tjc.compress();
File outFile = new File(argv[++i]);
@@ -291,6 +309,7 @@ final class TJComp {
}
try {
if (fis != null) fis.close();
if (fos != null) fos.close();
if (tjc != null) tjc.close();
} catch (Exception e) {}

View File

@@ -93,6 +93,9 @@ final class TJDecomp {
System.out.println("GENERAL OPTIONS (CAN BE ABBREVBIATED)");
System.out.println("-------------------------------------");
System.out.println("-icc FILE");
System.out.println(" Extract the ICC (International Color Consortium) color profile from the");
System.out.println(" JPEG image to the specified file");
System.out.println("-strict");
System.out.println(" Treat all warnings as fatal; abort immediately if incomplete or corrupt");
System.out.println(" data is encountered in the JPEG image, rather than trying to salvage the");
@@ -158,6 +161,7 @@ final class TJDecomp {
int exitStatus = 0;
TJDecompressor tjd = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try {
@@ -166,9 +170,10 @@ final class TJDecomp {
maxScans = -1, pixelFormat = TJ.PF_UNKNOWN, precision,
stopOnWarning = -1, subsamp;
java.awt.Rectangle croppingRegion = TJ.UNCROPPED;
String iccFilename = null;
TJScalingFactor scalingFactor = TJ.UNSCALED;
int width, height;
byte[] jpegBuf;
byte[] jpegBuf, iccBuf = null;
Object dstBuf = null;
for (i = 0; i < argv.length; i++) {
@@ -198,6 +203,8 @@ final class TJDecomp {
} else if (matchArg(argv[i], "-grayscale", 2) ||
matchArg(argv[i], "-greyscale", 2))
pixelFormat = TJ.PF_GRAY;
else if (matchArg(argv[i], "-icc", 2) && i < argv.length - 1)
iccFilename = argv[++i];
else if (matchArg(argv[i], "-maxscans", 5) && i < argv.length - 1) {
int temp = -1;
@@ -282,6 +289,17 @@ final class TJDecomp {
precision = tjd.get(TJ.PARAM_PRECISION);
colorspace = tjd.get(TJ.PARAM_COLORSPACE);
if (iccFilename != null) {
try {
iccBuf = tjd.getICCProfile();
} catch (TJException e) { handleTJException(e, stopOnWarning); }
if (iccBuf != null) {
File iccFile = new File(iccFilename);
fos = new FileOutputStream(iccFile);
fos.write(iccBuf, 0, iccBuf.length);
}
}
if (pixelFormat == TJ.PF_UNKNOWN) {
if (colorspace == TJ.CS_GRAY)
pixelFormat = TJ.PF_GRAY;
@@ -332,8 +350,9 @@ final class TJDecomp {
}
try {
if (fis != null) fis.close();
if (tjd != null) tjd.close();
if (fis != null) fis.close();
if (fos != null) fos.close();
} catch (Exception e) {}
System.exit(exitStatus);
}

View File

@@ -80,9 +80,15 @@ final class TJTran {
System.out.println(" entropy coding (can be combined with -progressive)");
System.out.println("-copy all");
System.out.println(" Copy all extra markers (including comments, JFIF thumbnails, Exif data, and");
System.out.println(" ICC profile data) from the input image to the output image [default]");
System.out.println(" ICC profile data) from the input image to the output image");
System.out.println("-copy comments");
System.out.println(" Do not copy any extra markers, except comment markers, from the input");
System.out.println(" image to the output image [default]");
System.out.println("-copy icc");
System.out.println(" Do not copy any extra markers, except ICC profile data, from the input");
System.out.println(" image to the output image");
System.out.println("-copy none");
System.out.println(" Copy no extra markers from the input image to the output image");
System.out.println(" Do not copy any extra markers from the input image to the output image");
System.out.println("-crop WxH+X+Y");
System.out.println(" Include only the specified region of the input image. (W, H, X, and Y are");
System.out.println(" the width, height, left boundary, and upper boundary of the region, all");
@@ -94,6 +100,9 @@ final class TJTran {
System.out.println(" mutually exclusive)");
System.out.println("-grayscale");
System.out.println(" Create a grayscale output image from a full-color input image");
System.out.println("-icc FILE");
System.out.println(" Embed the ICC (International Color Consortium) color management profile");
System.out.println(" from the specified file into the output image");
System.out.println("-maxmemory N");
System.out.println(" Memory limit (in megabytes) for intermediate buffers used with progressive");
System.out.println(" JPEG compression, Huffman table optimization, and lossless transformation");
@@ -145,11 +154,12 @@ final class TJTran {
int i;
int arithmetic = 0, maxMemory = -1, maxScans = -1, optimize = -1,
progressive = 0, restartIntervalBlocks = -1, restartIntervalRows = -1,
subsamp;
saveMarkers = 1, subsamp;
TJTransform[] xform = new TJTransform[1];
xform[0] = new TJTransform();
byte[] srcBuf;
int width, height;
String iccFilename = null;
byte[] srcBuf, iccBuf;
int width, height, iccSize = 0;
byte[][] dstBuf;
for (i = 0; i < argv.length; i++) {
@@ -175,9 +185,13 @@ final class TJTran {
xform[0].y = tempY;
} else if (matchArg(argv[i], "-copy", 2) && i < argv.length - 1) {
i++;
if (matchArg(argv[i], "none", 1))
xform[0].options |= TJTransform.OPT_COPYNONE;
else if (!matchArg(argv[i], "all", 1))
if (matchArg(argv[i], "all", 1))
saveMarkers = 2;
else if (matchArg(argv[i], "icc", 1))
saveMarkers = 4;
else if (matchArg(argv[i], "none", 1))
saveMarkers = 0;
else if (!matchArg(argv[i], "comments", 1))
usage();
} else if (matchArg(argv[i], "-flip", 2) && i < argv.length - 1) {
i++;
@@ -190,6 +204,8 @@ final class TJTran {
} else if (matchArg(argv[i], "-grayscale", 2) ||
matchArg(argv[i], "-greyscale", 2))
xform[0].options |= TJTransform.OPT_GRAY;
else if (matchArg(argv[i], "-icc", 2) && i < argv.length - 1)
iccFilename = argv[++i];
else if (matchArg(argv[i], "-maxscans", 5) && i < argv.length - 1) {
int temp = -1;
@@ -252,6 +268,11 @@ final class TJTran {
if (i != argv.length - 2)
usage();
if (iccFilename != null) {
if (saveMarkers == 2) saveMarkers = 3;
else if (saveMarkers == 4) saveMarkers = 0;
}
tjt = new TJTransformer();
if (optimize >= 0)
@@ -264,6 +285,7 @@ final class TJTran {
tjt.set(TJ.PARAM_RESTARTROWS, restartIntervalRows);
if (maxMemory >= 0)
tjt.set(TJ.PARAM_MAXMEMORY, maxMemory);
tjt.set(TJ.PARAM_SAVEMARKERS, saveMarkers);
File inFile = new File(argv[i++]);
fis = new FileInputStream(inFile);
@@ -315,13 +337,23 @@ final class TJTran {
xform[0].height += yAdjust;
}
dstBuf = new byte[1][TJ.bufSize(width, height, subsamp)];
if (iccFilename != null) {
File iccFile = new File(iccFilename);
fis = new FileInputStream(iccFile);
iccSize = fis.available();
if (iccSize < 1)
throw new Exception("ICC profile contains no data");
iccBuf = new byte[iccSize];
fis.read(iccBuf);
fis.close(); fis = null;
tjt.setICCProfile(iccBuf);
}
tjt.transform(dstBuf, xform);
TJDecompressor[] tjd = tjt.transform(xform);
File outFile = new File(argv[i]);
fos = new FileOutputStream(outFile);
fos.write(dstBuf[0], 0, tjt.getTransformedSizes()[0]);
fos.write(tjd[0].getJPEGBuf(), 0, tjd[0].getJPEGSize());
} catch (Exception e) {
e.printStackTrace();
exitStatus = -1;

View File

@@ -326,181 +326,188 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
<td class="colLast"><code>19</code></td>
</tr>
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PARAM_SAVEMARKERS">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_SAVEMARKERS">PARAM_SAVEMARKERS</a></code></th>
<td class="colLast"><code>25</code></td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PARAM_SCANLIMIT">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_SCANLIMIT">PARAM_SCANLIMIT</a></code></th>
<td class="colLast"><code>13</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PARAM_STOPONWARNING">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_STOPONWARNING">PARAM_STOPONWARNING</a></code></th>
<td class="colLast"><code>0</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PARAM_SUBSAMP">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_SUBSAMP">PARAM_SUBSAMP</a></code></th>
<td class="colLast"><code>4</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PARAM_XDENSITY">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_XDENSITY">PARAM_XDENSITY</a></code></th>
<td class="colLast"><code>20</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PARAM_YDENSITY">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_YDENSITY">PARAM_YDENSITY</a></code></th>
<td class="colLast"><code>21</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_ABGR">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ABGR">PF_ABGR</a></code></th>
<td class="colLast"><code>9</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_ARGB">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_ARGB">PF_ARGB</a></code></th>
<td class="colLast"><code>10</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_BGR">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</a></code></th>
<td class="colLast"><code>1</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_BGRA">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRA">PF_BGRA</a></code></th>
<td class="colLast"><code>8</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_BGRX">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</a></code></th>
<td class="colLast"><code>3</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_CMYK">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_CMYK">PF_CMYK</a></code></th>
<td class="colLast"><code>11</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_GRAY">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</a></code></th>
<td class="colLast"><code>6</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_RGB">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</a></code></th>
<td class="colLast"><code>0</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_RGBA">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBA">PF_RGBA</a></code></th>
<td class="colLast"><code>7</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_RGBX">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</a></code></th>
<td class="colLast"><code>2</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_UNKNOWN">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_UNKNOWN">PF_UNKNOWN</a></code></th>
<td class="colLast"><code>-1</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_XBGR">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</a></code></th>
<td class="colLast"><code>4</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.PF_XRGB">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</a></code></th>
<td class="colLast"><code>5</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.SAMP_411">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_411">SAMP_411</a></code></th>
<td class="colLast"><code>5</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.SAMP_420">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</a></code></th>
<td class="colLast"><code>2</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.SAMP_422">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</a></code></th>
<td class="colLast"><code>1</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.SAMP_440">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</a></code></th>
<td class="colLast"><code>4</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.SAMP_441">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_441">SAMP_441</a></code></th>
<td class="colLast"><code>6</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.SAMP_444">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</a></code></th>
<td class="colLast"><code>0</code></td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.SAMP_GRAY">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<th class="colSecond" scope="row"><code><a href="org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY">SAMP_GRAY</a></code></th>
<td class="colLast"><code>3</code></td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><a id="org.libjpegturbo.turbojpeg.TJ.SAMP_UNKNOWN">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>

View File

@@ -359,6 +359,20 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
<dd>
<div class="block">Returns the height of the YUV image (or subregion.)</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#getICCProfile()">getICCProfile()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Retrieve the ICC (International Color Consortium) color management profile
(if any) that was previously extracted from the JPEG image associated with
this decompressor instance (see <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte%5B%5D,int)"><code>TJDecompressor.setSourceImage(byte[], int)</code></a>), and
return a buffer containing the ICC profile.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#getICCSize()">getICCSize()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Returns the size of the ICC profile (if any) that was previously extracted
from the JPEG image associated with this decompressor instance
(see <a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#setSourceImage(byte%5B%5D,int)"><code>TJDecompressor.setSourceImage(byte[], int)</code></a>), or 0 if there is no ICC
profile to retrieve.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf()</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Returns the JPEG buffer associated with this decompressor instance.</div>
@@ -680,6 +694,10 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
<dd>
<div class="block">JPEG restart marker interval in MCU rows [compression only]</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_SAVEMARKERS">PARAM_SAVEMARKERS</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
<dd>
<div class="block">Marker copying behavior [decompression, lossless transformation]</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJ.html#PARAM_SCANLIMIT">PARAM_SCANLIMIT</a></span> - Static variable in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</a></dt>
<dd>
<div class="block">Progressive JPEG scan limit for lossy JPEG images [decompression, lossless
@@ -834,6 +852,16 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
<div class="block">Set the cropping region for partially decompressing a lossy JPEG image
into a packed-pixel image.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJCompressor.html#setICCProfile(byte%5B%5D)">setICCProfile(byte[])</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</a></dt>
<dd>
<div class="block">Embed an ICC (International Color Consortium) color management profile in
JPEG images generated by subsequent compression operations.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJTransformer.html#setICCProfile(byte%5B%5D)">setICCProfile(byte[])</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</a></dt>
<dd>
<div class="block">Embed an ICC (International Color Consortium) color management profile in
JPEG images generated by subsequent transform operations.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/libjpegturbo/turbojpeg/TJDecompressor.html#setScalingFactor(org.libjpegturbo.turbojpeg.TJScalingFactor)">setScalingFactor(TJScalingFactor)</a></span> - Method in class org.libjpegturbo.turbojpeg.<a href="org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></dt>
<dd>
<div class="block">Set the scaling factor for subsequent lossy decompression operations.</div>

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -366,83 +366,90 @@ extends java.lang.Object</pre>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PARAM_SAVEMARKERS">PARAM_SAVEMARKERS</a></span></code></th>
<td class="colLast">
<div class="block">Marker copying behavior [decompression, lossless transformation]</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PARAM_SCANLIMIT">PARAM_SCANLIMIT</a></span></code></th>
<td class="colLast">
<div class="block">Progressive JPEG scan limit for lossy JPEG images [decompression, lossless
transformation]</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PARAM_STOPONWARNING">PARAM_STOPONWARNING</a></span></code></th>
<td class="colLast">
<div class="block">Error handling behavior</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PARAM_SUBSAMP">PARAM_SUBSAMP</a></span></code></th>
<td class="colLast">
<div class="block">Chrominance subsampling level</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PARAM_XDENSITY">PARAM_XDENSITY</a></span></code></th>
<td class="colLast">
<div class="block">JPEG horizontal pixel density</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PARAM_YDENSITY">PARAM_YDENSITY</a></span></code></th>
<td class="colLast">
<div class="block">JPEG vertical pixel density</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_ABGR">PF_ABGR</a></span></code></th>
<td class="colLast">
<div class="block">ABGR pixel format</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_ARGB">PF_ARGB</a></span></code></th>
<td class="colLast">
<div class="block">ARGB pixel format</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_BGR">PF_BGR</a></span></code></th>
<td class="colLast">
<div class="block">BGR pixel format</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_BGRA">PF_BGRA</a></span></code></th>
<td class="colLast">
<div class="block">BGRA pixel format</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_BGRX">PF_BGRX</a></span></code></th>
<td class="colLast">
<div class="block">BGRX pixel format</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_CMYK">PF_CMYK</a></span></code></th>
<td class="colLast">
<div class="block">CMYK pixel format</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_GRAY">PF_GRAY</a></span></code></th>
<td class="colLast">
@@ -453,112 +460,112 @@ extends java.lang.Object</pre>
or 4095 for 12-bit samples or 65535 for 16-bit samples.)</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_RGB">PF_RGB</a></span></code></th>
<td class="colLast">
<div class="block">RGB pixel format</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_RGBA">PF_RGBA</a></span></code></th>
<td class="colLast">
<div class="block">RGBA pixel format</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_RGBX">PF_RGBX</a></span></code></th>
<td class="colLast">
<div class="block">RGBX pixel format</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_UNKNOWN">PF_UNKNOWN</a></span></code></th>
<td class="colLast">
<div class="block">Unknown pixel format</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_XBGR">PF_XBGR</a></span></code></th>
<td class="colLast">
<div class="block">XBGR pixel format</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#PF_XRGB">PF_XRGB</a></span></code></th>
<td class="colLast">
<div class="block">XRGB pixel format</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SAMP_411">SAMP_411</a></span></code></th>
<td class="colLast">
<div class="block">4:1:1 chrominance subsampling</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SAMP_420">SAMP_420</a></span></code></th>
<td class="colLast">
<div class="block">4:2:0 chrominance subsampling</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SAMP_422">SAMP_422</a></span></code></th>
<td class="colLast">
<div class="block">4:2:2 chrominance subsampling</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SAMP_440">SAMP_440</a></span></code></th>
<td class="colLast">
<div class="block">4:4:0 chrominance subsampling</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SAMP_441">SAMP_441</a></span></code></th>
<td class="colLast">
<div class="block">4:4:1 chrominance subsampling</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SAMP_444">SAMP_444</a></span></code></th>
<td class="colLast">
<div class="block">4:4:4 chrominance subsampling (no chrominance subsampling)</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SAMP_GRAY">SAMP_GRAY</a></span></code></th>
<td class="colLast">
<div class="block">Grayscale</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SAMP_UNKNOWN">SAMP_UNKNOWN</a></span></code></th>
<td class="colLast">
<div class="block">Unknown subsampling</div>
</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static java.awt.Rectangle</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#UNCROPPED">UNCROPPED</a></span></code></th>
<td class="colLast">
<div class="block">A <code>java.awt.Rectangle</code> instance that specifies no cropping</div>
</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>static <a href="TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#UNSCALED">UNSCALED</a></span></code></th>
<td class="colLast">
@@ -1979,6 +1986,47 @@ extends java.lang.Object</pre>
</dl>
</li>
</ul>
<a id="PARAM_SAVEMARKERS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PARAM_SAVEMARKERS</h4>
<pre>public static final&nbsp;int PARAM_SAVEMARKERS</pre>
<div class="block">Marker copying behavior [decompression, lossless transformation]
<p><b>Value [lossless transformation]</b>
<ul>
<li> <code>0</code> Do not copy any extra markers (including comments,
JFIF thumbnails, Exif data, and ICC profile data) from the source image to
the destination image.
<li> <code>1</code> Do not copy any extra markers, except comment (COM)
markers, from the source image to the destination image.
<li> <code>2</code> <i>[default]</i> Copy all extra markers from the
source image to the destination image.
<li> <code>3</code> Copy all extra markers, except ICC profile data (APP2
markers), from the source image to the destination image.
<li> <code>4</code> Do not copy any extra markers, except ICC profile data
(APP2 markers), from the source image to the destination image.
</ul>
<p><a href="TJTransform.html#OPT_COPYNONE"><code>TJTransform.OPT_COPYNONE</code></a> overrides this parameter for a
particular transform. This parameter overrides any ICC profile that was
previously associated with a compressor instance using
<a href="TJCompressor.html#setICCProfile(byte%5B%5D)"><code>TJCompressor.setICCProfile()</code></a> or with a
transformer instance using <a href="TJTransformer.html#setICCProfile(byte%5B%5D)"><code>TJTransformer.setICCProfile()</code></a>.
<p>When decompressing, associating a JPEG source image with the
decompressor instance extracts the ICC profile from the source image if
this parameter is set to <code>2</code> or <code>4</code>.
<a href="TJDecompressor.html#getICCProfile()"><code>TJDecompressor.getICCProfile()</code></a> can then be used to retrieve the
profile.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PARAM_SAVEMARKERS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="NUMERR">
<!-- -->
</a>

View File

@@ -27,7 +27,7 @@
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10};
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
@@ -340,6 +340,14 @@ implements java.io.Closeable</pre>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setICCProfile(byte%5B%5D)">setICCProfile</a></span>&#8203;(byte[]&nbsp;iccBuf)</code></th>
<td class="colLast">
<div class="block">Embed an ICC (International Color Consortium) color management profile in
JPEG images generated by subsequent compression operations.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSourceImage(byte%5B%5D,int,int,int,int,int,int)">setSourceImage</a></span>&#8203;(byte[]&nbsp;srcImage,
int&nbsp;x,
int&nbsp;y,
@@ -352,7 +360,7 @@ implements java.io.Closeable</pre>
bits of data precision per sample with this compressor instance.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSourceImage(java.awt.image.BufferedImage,int,int,int,int)">setSourceImage</a></span>&#8203;(java.awt.image.BufferedImage&nbsp;srcImage,
int&nbsp;x,
@@ -364,7 +372,7 @@ implements java.io.Closeable</pre>
with this compressor instance.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></span>&#8203;(<a href="YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a>&nbsp;srcImage)</code></th>
<td class="colLast">
@@ -372,7 +380,7 @@ implements java.io.Closeable</pre>
instance.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSourceImage12(short%5B%5D,int,int,int,int,int,int)">setSourceImage12</a></span>&#8203;(short[]&nbsp;srcImage,
int&nbsp;x,
@@ -386,7 +394,7 @@ implements java.io.Closeable</pre>
bits of data precision per sample with this compressor instance.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSourceImage16(short%5B%5D,int,int,int,int,int,int)">setSourceImage16</a></span>&#8203;(short[]&nbsp;srcImage,
int&nbsp;x,
@@ -891,6 +899,28 @@ implements java.io.Closeable</pre>
</dl>
</li>
</ul>
<a id="setICCProfile(byte[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setICCProfile</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setICCProfile&#8203;(byte[]&nbsp;iccBuf)
throws <a href="TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<div class="block">Embed an ICC (International Color Consortium) color management profile in
JPEG images generated by subsequent compression operations.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>iccBuf</code> - buffer containing an ICC profile. (The size of the ICC
profile is assumed to be the length of the array.) A copy is made of the
ICC profile, so this buffer can be reused as soon as this method returns.
Setting this parameter to null removes any ICC profile that was previously
associated with this compressor instance.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd>
</dl>
</li>
</ul>
<a id="compress(byte[])">
<!-- -->
</a>
@@ -907,7 +937,9 @@ implements java.io.Closeable</pre>
<dd><code>dstBuf</code> - buffer that will receive the JPEG image. Use
<a href="TJ.html#bufSize(int,int,int)"><code>TJ.bufSize()</code></a> to determine the maximum size for this
buffer based on the source image's width and height and the desired level
of chrominance subsampling (see <a href="TJ.html#PARAM_SUBSAMP"><code>TJ.PARAM_SUBSAMP</code></a>.)</dd>
of chrominance subsampling (see <a href="TJ.html#PARAM_SUBSAMP"><code>TJ.PARAM_SUBSAMP</code></a>), then add the
size of the ICC profile (if any) that was previously associated with this
compressor instance (see <a href="#setICCProfile(byte%5B%5D)"><code>setICCProfile()</code></a>.)</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd>
</dl>

View File

@@ -27,7 +27,7 @@
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10};
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
@@ -375,12 +375,32 @@ implements java.io.Closeable</pre>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getICCProfile()">getICCProfile</a></span>()</code></th>
<td class="colLast">
<div class="block">Retrieve the ICC (International Color Consortium) color management profile
(if any) that was previously extracted from the JPEG image associated with
this decompressor instance (see <a href="#setSourceImage(byte%5B%5D,int)"><code>setSourceImage(byte[], int)</code></a>), and
return a buffer containing the ICC profile.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getICCSize()">getICCSize</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the size of the ICC profile (if any) that was previously extracted
from the JPEG image associated with this decompressor instance
(see <a href="#setSourceImage(byte%5B%5D,int)"><code>setSourceImage(byte[], int)</code></a>), or 0 if there is no ICC
profile to retrieve.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getJPEGBuf()">getJPEGBuf</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the JPEG buffer associated with this decompressor instance.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<tr id="i19" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getJPEGSize()">getJPEGSize</a></span>()</code></th>
<td class="colLast">
@@ -388,7 +408,7 @@ implements java.io.Closeable</pre>
decompressor instance.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<tr id="i20" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getWidth()">getWidth</a></span>()</code></th>
<td class="colLast">
@@ -396,7 +416,7 @@ implements java.io.Closeable</pre>
decompressor instance.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#saveImage(java.lang.String,java.lang.Object,int,int,int,int,int,int)">saveImage</a></span>&#8203;(java.lang.String&nbsp;fileName,
java.lang.Object&nbsp;image,
@@ -411,7 +431,7 @@ implements java.io.Closeable</pre>
from memory to disk.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<tr id="i22" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#set(int,int)">set</a></span>&#8203;(int&nbsp;param,
int&nbsp;value)</code></th>
@@ -419,7 +439,7 @@ implements java.io.Closeable</pre>
<div class="block">Set the value of a decompression parameter.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<tr id="i23" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setCroppingRegion(java.awt.Rectangle)">setCroppingRegion</a></span>&#8203;(java.awt.Rectangle&nbsp;croppingRegion)</code></th>
<td class="colLast">
@@ -427,14 +447,14 @@ implements java.io.Closeable</pre>
into a packed-pixel image.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<tr id="i24" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setScalingFactor(org.libjpegturbo.turbojpeg.TJScalingFactor)">setScalingFactor</a></span>&#8203;(<a href="TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</a>&nbsp;scalingFactor)</code></th>
<td class="colLast">
<div class="block">Set the scaling factor for subsequent lossy decompression operations.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<tr id="i25" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSourceImage(byte%5B%5D,int)">setSourceImage</a></span>&#8203;(byte[]&nbsp;jpegImage,
int&nbsp;imageSize)</code></th>
@@ -444,7 +464,7 @@ implements java.io.Closeable</pre>
<code>jpegImage</code> with this decompressor instance.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<tr id="i26" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></span>&#8203;(<a href="YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a>&nbsp;srcImage)</code></th>
<td class="colLast">
@@ -589,7 +609,11 @@ implements java.io.Closeable</pre>
when decompressing video streams in which all frames share the same
quantization and Huffman tables. If a JPEG image is passed to this
method, then the <a href="TJ.html#PARAM_STOPONWARNING"><code>parameters</code></a> that describe
the JPEG image will be set when the method returns.</div>
the JPEG image will be set when the method returns. If a JPEG image is
passed to this method and <a href="TJ.html#PARAM_SAVEMARKERS"><code>TJ.PARAM_SAVEMARKERS</code></a> is set to
<code>2</code> or <code>4</code>, then the ICC profile (if any) will be
extracted from the JPEG image. (<a href="#getICCProfile()"><code>getICCProfile()</code></a> can then be used
to retrieve the profile.)</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jpegImage</code> - buffer containing a JPEG source image or tables-only
@@ -686,6 +710,47 @@ implements java.io.Closeable</pre>
</dl>
</li>
</ul>
<a id="getICCProfile()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getICCProfile</h4>
<pre class="methodSignature">public&nbsp;byte[]&nbsp;getICCProfile()
throws <a href="TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<div class="block">Retrieve the ICC (International Color Consortium) color management profile
(if any) that was previously extracted from the JPEG image associated with
this decompressor instance (see <a href="#setSourceImage(byte%5B%5D,int)"><code>setSourceImage(byte[], int)</code></a>), and
return a buffer containing the ICC profile. Once the ICC profile is
retrieved, it must be re-extracted before it can be retrieved again.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a buffer containing the ICC profile</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd>
</dl>
</li>
</ul>
<a id="getICCSize()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getICCSize</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;getICCSize()</pre>
<div class="block">Returns the size of the ICC profile (if any) that was previously extracted
from the JPEG image associated with this decompressor instance
(see <a href="#setSourceImage(byte%5B%5D,int)"><code>setSourceImage(byte[], int)</code></a>), or 0 if there is no ICC
profile to retrieve.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the size of the ICC profile (if any) that was previously extracted
from the JPEG image associated with this decompressor instance
(see <a href="#setSourceImage(byte%5B%5D,int)"><code>setSourceImage(byte[], int)</code></a>), or 0 if there is no ICC
profile to retrieve.</dd>
</dl>
</li>
</ul>
<a id="setScalingFactor(org.libjpegturbo.turbojpeg.TJScalingFactor)">
<!-- -->
</a>

View File

@@ -27,7 +27,7 @@
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10};
var data = {"i0":10,"i1":10,"i2":10,"i3":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
@@ -212,6 +212,14 @@ extends <a href="TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setICCProfile(byte%5B%5D)">setICCProfile</a></span>&#8203;(byte[]&nbsp;iccBuf)</code></th>
<td class="colLast">
<div class="block">Embed an ICC (International Color Consortium) color management profile in
JPEG images generated by subsequent transform operations.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#transform(byte%5B%5D%5B%5D,org.libjpegturbo.turbojpeg.TJTransform%5B%5D)">transform</a></span>&#8203;(byte[][]&nbsp;dstBufs,
<a href="TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[]&nbsp;transforms)</code></th>
<td class="colLast">
@@ -220,7 +228,7 @@ extends <a href="TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg
destination buffers.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a>[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#transform(org.libjpegturbo.turbojpeg.TJTransform%5B%5D)">transform</a></span>&#8203;(<a href="TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</a>[]&nbsp;transforms)</code></th>
<td class="colLast">
@@ -235,7 +243,7 @@ extends <a href="TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.libjpegturbo.turbojpeg.<a href="TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</a></h3>
<code><a href="TJDecompressor.html#close()">close</a>, <a href="TJDecompressor.html#decompress12(int,int)">decompress12</a>, <a href="TJDecompressor.html#decompress12(short%5B%5D,int,int,int,int)">decompress12</a>, <a href="TJDecompressor.html#decompress16(int,int)">decompress16</a>, <a href="TJDecompressor.html#decompress16(short%5B%5D,int,int,int,int)">decompress16</a>, <a href="TJDecompressor.html#decompress8(byte%5B%5D,int,int,int,int)">decompress8</a>, <a href="TJDecompressor.html#decompress8(int)">decompress8</a>, <a href="TJDecompressor.html#decompress8(int%5B%5D,int,int,int,int)">decompress8</a>, <a href="TJDecompressor.html#decompress8(int,int)">decompress8</a>, <a href="TJDecompressor.html#decompress8(java.awt.image.BufferedImage)">decompress8</a>, <a href="TJDecompressor.html#decompressToYUV(int)">decompressToYUV</a>, <a href="TJDecompressor.html#decompressToYUV(int%5B%5D)">decompressToYUV</a>, <a href="TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage)">decompressToYUV</a>, <a href="TJDecompressor.html#finalize()">finalize</a>, <a href="TJDecompressor.html#get(int)">get</a>, <a href="TJDecompressor.html#getHeight()">getHeight</a>, <a href="TJDecompressor.html#getJPEGBuf()">getJPEGBuf</a>, <a href="TJDecompressor.html#getJPEGSize()">getJPEGSize</a>, <a href="TJDecompressor.html#getWidth()">getWidth</a>, <a href="TJDecompressor.html#saveImage(java.lang.String,java.lang.Object,int,int,int,int,int,int)">saveImage</a>, <a href="TJDecompressor.html#set(int,int)">set</a>, <a href="TJDecompressor.html#setCroppingRegion(java.awt.Rectangle)">setCroppingRegion</a>, <a href="TJDecompressor.html#setScalingFactor(org.libjpegturbo.turbojpeg.TJScalingFactor)">setScalingFactor</a>, <a href="TJDecompressor.html#setSourceImage(byte%5B%5D,int)">setSourceImage</a>, <a href="TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></code></li>
<code><a href="TJDecompressor.html#close()">close</a>, <a href="TJDecompressor.html#decompress12(int,int)">decompress12</a>, <a href="TJDecompressor.html#decompress12(short%5B%5D,int,int,int,int)">decompress12</a>, <a href="TJDecompressor.html#decompress16(int,int)">decompress16</a>, <a href="TJDecompressor.html#decompress16(short%5B%5D,int,int,int,int)">decompress16</a>, <a href="TJDecompressor.html#decompress8(byte%5B%5D,int,int,int,int)">decompress8</a>, <a href="TJDecompressor.html#decompress8(int)">decompress8</a>, <a href="TJDecompressor.html#decompress8(int%5B%5D,int,int,int,int)">decompress8</a>, <a href="TJDecompressor.html#decompress8(int,int)">decompress8</a>, <a href="TJDecompressor.html#decompress8(java.awt.image.BufferedImage)">decompress8</a>, <a href="TJDecompressor.html#decompressToYUV(int)">decompressToYUV</a>, <a href="TJDecompressor.html#decompressToYUV(int%5B%5D)">decompressToYUV</a>, <a href="TJDecompressor.html#decompressToYUV(org.libjpegturbo.turbojpeg.YUVImage)">decompressToYUV</a>, <a href="TJDecompressor.html#finalize()">finalize</a>, <a href="TJDecompressor.html#get(int)">get</a>, <a href="TJDecompressor.html#getHeight()">getHeight</a>, <a href="TJDecompressor.html#getICCProfile()">getICCProfile</a>, <a href="TJDecompressor.html#getICCSize()">getICCSize</a>, <a href="TJDecompressor.html#getJPEGBuf()">getJPEGBuf</a>, <a href="TJDecompressor.html#getJPEGSize()">getJPEGSize</a>, <a href="TJDecompressor.html#getWidth()">getWidth</a>, <a href="TJDecompressor.html#saveImage(java.lang.String,java.lang.Object,int,int,int,int,int,int)">saveImage</a>, <a href="TJDecompressor.html#set(int,int)">set</a>, <a href="TJDecompressor.html#setCroppingRegion(java.awt.Rectangle)">setCroppingRegion</a>, <a href="TJDecompressor.html#setScalingFactor(org.libjpegturbo.turbojpeg.TJScalingFactor)">setScalingFactor</a>, <a href="TJDecompressor.html#setSourceImage(byte%5B%5D,int)">setSourceImage</a>, <a href="TJDecompressor.html#setSourceImage(org.libjpegturbo.turbojpeg.YUVImage)">setSourceImage</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
@@ -328,6 +336,28 @@ extends <a href="TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="setICCProfile(byte[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setICCProfile</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setICCProfile&#8203;(byte[]&nbsp;iccBuf)
throws <a href="TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></pre>
<div class="block">Embed an ICC (International Color Consortium) color management profile in
JPEG images generated by subsequent transform operations.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>iccBuf</code> - buffer containing an ICC profile. (The size of the ICC
profile is assumed to be the length of the array.) A copy is made of the
ICC profile, so this buffer can be reused as soon as this method returns.
Setting this parameter to null removes any ICC profile that was previously
associated with this transformer instance.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="TJException.html" title="class in org.libjpegturbo.turbojpeg">TJException</a></code></dd>
</dl>
</li>
</ul>
<a id="transform(byte[][],org.libjpegturbo.turbojpeg.TJTransform[])">
<!-- -->
</a>
@@ -357,7 +387,11 @@ extends <a href="TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg
<a href="TJ.html#bufSize(int,int,int)"><code>TJ.bufSize()</code></a> to determine the maximum size for each
buffer based on the transformed or cropped width and height and the level
of subsampling used in the destination image (taking into account
grayscale conversion and transposition of the width and height.)</dd>
grayscale conversion and transposition of the width and height), then add
the size of the ICC profile (if any) that was previously associated with
this transformer instance (see <a href="#setICCProfile(byte%5B%5D)"><code>setICCProfile()</code></a>) or
extracted from the source image (see
<a href="TJDecompressor.html#getICCProfile()"><code>TJDecompressor.getICCProfile()</code></a> and <a href="TJ.html#PARAM_SAVEMARKERS"><code>TJ.PARAM_SAVEMARKERS</code></a>.)</dd>
<dd><code>transforms</code> - an array of <a href="TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><code>TJTransform</code></a> instances, each of
which specifies the transform parameters and/or cropping region for the
corresponding transformed JPEG image</dd>

Binary file not shown.

Binary file not shown.

View File

@@ -951,6 +951,38 @@ public final class TJ {
* </ul>
*/
public static final int PARAM_MAXPIXELS = 24;
/**
* Marker copying behavior [decompression, lossless transformation]
*
* <p><b>Value [lossless transformation]</b>
* <ul>
* <li> <code>0</code> Do not copy any extra markers (including comments,
* JFIF thumbnails, Exif data, and ICC profile data) from the source image to
* the destination image.
* <li> <code>1</code> Do not copy any extra markers, except comment (COM)
* markers, from the source image to the destination image.
* <li> <code>2</code> <i>[default]</i> Copy all extra markers from the
* source image to the destination image.
* <li> <code>3</code> Copy all extra markers, except ICC profile data (APP2
* markers), from the source image to the destination image.
* <li> <code>4</code> Do not copy any extra markers, except ICC profile data
* (APP2 markers), from the source image to the destination image.
* </ul>
*
* <p>{@link TJTransform#OPT_COPYNONE} overrides this parameter for a
* particular transform. This parameter overrides any ICC profile that was
* previously associated with a compressor instance using
* {@link TJCompressor#setICCProfile TJCompressor.setICCProfile()} or with a
* transformer instance using {@link TJTransformer#setICCProfile
* TJTransformer.setICCProfile()}.
*
* <p>When decompressing, associating a JPEG source image with the
* decompressor instance extracts the ICC profile from the source image if
* this parameter is set to <code>2</code> or <code>4</code>.
* {@link TJDecompressor#getICCProfile} can then be used to retrieve the
* profile.
*/
public static final int PARAM_SAVEMARKERS = 25;
/**

View File

@@ -552,6 +552,18 @@ public class TJCompressor implements Closeable {
*/
public native int get(int param);
/**
* Embed an ICC (International Color Consortium) color management profile in
* JPEG images generated by subsequent compression operations.
*
* @param iccBuf buffer containing an ICC profile. (The size of the ICC
* profile is assumed to be the length of the array.) A copy is made of the
* ICC profile, so this buffer can be reused as soon as this method returns.
* Setting this parameter to null removes any ICC profile that was previously
* associated with this compressor instance.
*/
public native void setICCProfile(byte[] iccBuf) throws TJException;
/**
* Compress the packed-pixel or planar YUV source image associated with this
* compressor instance and output a JPEG image to the given destination
@@ -560,7 +572,9 @@ public class TJCompressor implements Closeable {
* @param dstBuf buffer that will receive the JPEG image. Use
* {@link TJ#bufSize TJ.bufSize()} to determine the maximum size for this
* buffer based on the source image's width and height and the desired level
* of chrominance subsampling (see {@link TJ#PARAM_SUBSAMP}.)
* of chrominance subsampling (see {@link TJ#PARAM_SUBSAMP}), then add the
* size of the ICC profile (if any) that was previously associated with this
* compressor instance (see {@link #setICCProfile setICCProfile()}.)
*/
public void compress(byte[] dstBuf) throws TJException {
if (dstBuf == null)
@@ -610,7 +624,7 @@ public class TJCompressor implements Closeable {
int subsamp = get(TJ.PARAM_SUBSAMP);
if (get(TJ.PARAM_LOSSLESS) == 1 && subsamp != TJ.SAMP_GRAY)
subsamp = TJ.SAMP_444;
buf = new byte[TJ.bufSize(srcWidth, srcHeight, subsamp)];
buf = new byte[TJ.bufSize(srcWidth, srcHeight, subsamp) + iccSize];
}
compress(buf);
return buf;
@@ -803,4 +817,5 @@ public class TJCompressor implements Closeable {
private YUVImage srcYUVImage = null;
private int compressedSize = 0;
private ByteOrder byteOrder = null;
private int iccSize = 0;
}

View File

@@ -110,7 +110,11 @@ public class TJDecompressor implements Closeable {
* when decompressing video streams in which all frames share the same
* quantization and Huffman tables. If a JPEG image is passed to this
* method, then the {@link TJ#PARAM_STOPONWARNING parameters} that describe
* the JPEG image will be set when the method returns.
* the JPEG image will be set when the method returns. If a JPEG image is
* passed to this method and {@link TJ#PARAM_SAVEMARKERS} is set to
* <code>2</code> or <code>4</code>, then the ICC profile (if any) will be
* extracted from the JPEG image. ({@link #getICCProfile()} can then be used
* to retrieve the profile.)
*
* @param jpegImage buffer containing a JPEG source image or tables-only
* datastream. This buffer is not modified.
@@ -208,6 +212,30 @@ public class TJDecompressor implements Closeable {
*/
public native int get(int param);
/**
* Retrieve the ICC (International Color Consortium) color management profile
* (if any) that was previously extracted from the JPEG image associated with
* this decompressor instance (see {@link #setSourceImage(byte[], int)}), and
* return a buffer containing the ICC profile. Once the ICC profile is
* retrieved, it must be re-extracted before it can be retrieved again.
*
* @return a buffer containing the ICC profile
*/
public native byte[] getICCProfile() throws TJException;
/**
* Returns the size of the ICC profile (if any) that was previously extracted
* from the JPEG image associated with this decompressor instance
* (see {@link #setSourceImage(byte[], int)}), or 0 if there is no ICC
* profile to retrieve.
*
* @return the size of the ICC profile (if any) that was previously extracted
* from the JPEG image associated with this decompressor instance
* (see {@link #setSourceImage(byte[], int)}), or 0 if there is no ICC
* profile to retrieve.
*/
public native int getICCSize();
/**
* Set the scaling factor for subsequent lossy decompression operations.
*

View File

@@ -70,6 +70,18 @@ public class TJTransformer extends TJDecompressor {
setSourceImage(jpegImage, imageSize);
}
/**
* Embed an ICC (International Color Consortium) color management profile in
* JPEG images generated by subsequent transform operations.
*
* @param iccBuf buffer containing an ICC profile. (The size of the ICC
* profile is assumed to be the length of the array.) A copy is made of the
* ICC profile, so this buffer can be reused as soon as this method returns.
* Setting this parameter to null removes any ICC profile that was previously
* associated with this transformer instance.
*/
public native void setICCProfile(byte[] iccBuf) throws TJException;
/**
* Losslessly transform the JPEG source image associated with this
* transformer instance into one or more JPEG images stored in the given
@@ -90,7 +102,11 @@ public class TJTransformer extends TJDecompressor {
* {@link TJ#bufSize TJ.bufSize()} to determine the maximum size for each
* buffer based on the transformed or cropped width and height and the level
* of subsampling used in the destination image (taking into account
* grayscale conversion and transposition of the width and height.)
* grayscale conversion and transposition of the width and height), then add
* the size of the ICC profile (if any) that was previously associated with
* this transformer instance (see {@link #setICCProfile setICCProfile()}) or
* extracted from the source image (see
* {@link TJDecompressor#getICCProfile()} and {@link TJ#PARAM_SAVEMARKERS}.)
*
* @param transforms an array of {@link TJTransform} instances, each of
* which specifies the transform parameters and/or cropping region for the
@@ -120,9 +136,11 @@ public class TJTransformer extends TJDecompressor {
if (getWidth() < 1 || getHeight() < 1)
throw new IllegalStateException("JPEG buffer not initialized");
int srcSubsamp = get(TJ.PARAM_SUBSAMP);
int saveMarkers = get(TJ.PARAM_SAVEMARKERS);
int extractedICCSize = getICCSize();
for (int i = 0; i < transforms.length; i++) {
int w = getWidth(), h = getHeight();
int dstSubsamp = srcSubsamp;
int dstSubsamp = srcSubsamp, iccLen = iccSize;
if ((transforms[i].options & TJTransform.OPT_GRAY) != 0)
dstSubsamp = TJ.SAMP_GRAY;
@@ -145,7 +163,10 @@ public class TJTransformer extends TJDecompressor {
if (transforms[i].width != 0) w = transforms[i].width;
if (transforms[i].height != 0) h = transforms[i].height;
}
dstBufs[i] = new byte[TJ.bufSize(w, h, dstSubsamp)];
if ((saveMarkers == 2 || saveMarkers == 4) &&
(transforms[i].options & TJTransform.OPT_COPYNONE) == 0)
iccLen = extractedICCSize;
dstBufs[i] = new byte[TJ.bufSize(w, h, dstSubsamp) + iccLen];
}
TJDecompressor[] tjd = new TJDecompressor[transforms.length];
transform(dstBufs, transforms);
@@ -177,4 +198,5 @@ public class TJTransformer extends TJDecompressor {
}
private int[] transformedSizes = null;
private int iccSize = 0;
}

View File

@@ -113,6 +113,8 @@ extern "C" {
#define org_libjpegturbo_turbojpeg_TJ_PARAM_MAXMEMORY 23L
#undef org_libjpegturbo_turbojpeg_TJ_PARAM_MAXPIXELS
#define org_libjpegturbo_turbojpeg_TJ_PARAM_MAXPIXELS 24L
#undef org_libjpegturbo_turbojpeg_TJ_PARAM_SAVEMARKERS
#define org_libjpegturbo_turbojpeg_TJ_PARAM_SAVEMARKERS 25L
#undef org_libjpegturbo_turbojpeg_TJ_NUMERR
#define org_libjpegturbo_turbojpeg_TJ_NUMERR 2L
#undef org_libjpegturbo_turbojpeg_TJ_ERR_WARNING

View File

@@ -23,6 +23,14 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_set
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_get
(JNIEnv *, jobject, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: setICCProfile
* Signature: ([B)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_setICCProfile
(JNIEnv *, jobject, jbyteArray);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: init

View File

@@ -23,6 +23,22 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_set
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_get
(JNIEnv *, jobject, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: getICCProfile
* Signature: ()[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_getICCProfile
(JNIEnv *, jobject);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: getICCSize
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_getICCSize
(JNIEnv *, jobject);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: init

View File

@@ -7,6 +7,14 @@
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_libjpegturbo_turbojpeg_TJTransformer
* Method: setICCProfile
* Signature: ([B)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_setICCProfile
(JNIEnv *, jobject, jbyteArray);
/*
* Class: org_libjpegturbo_turbojpeg_TJTransformer
* Method: init

View File

@@ -179,7 +179,7 @@ bailout:
return;
}
/* TurboJPEG 3: TJCompressor.set() */
/* TurboJPEG 3.0.x: TJCompressor.set() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_set
(JNIEnv *env, jobject obj, jint param, jint value)
{
@@ -194,7 +194,7 @@ bailout:
return;
}
/* TurboJPEG 3: TJCompressor.get() */
/* TurboJPEG 3.0.x: TJCompressor.get() */
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_get
(JNIEnv *env, jobject obj, jint param)
{
@@ -208,6 +208,38 @@ bailout:
return -1;
}
/* TurboJPEG 3.1.x: TJCompressor.setICCProfile() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_setICCProfile
(JNIEnv *env, jobject obj, jbyteArray icc)
{
jclass cls;
jfieldID fid;
tjhandle handle = 0;
unsigned char *iccBuf = NULL;
size_t iccSize = 0;
GET_HANDLE();
if (icc != NULL) {
BAILIF0NOEC(iccBuf = (*env)->GetPrimitiveArrayCritical(env, icc, 0));
iccSize = (size_t)(*env)->GetArrayLength(env, icc);
}
BAILIF0(cls = (*env)->GetObjectClass(env, obj));
BAILIF0(fid = (*env)->GetFieldID(env, cls, "iccSize", "I"));
if (tj3SetICCProfile(handle, iccBuf, iccSize) == -1) {
(*env)->SetIntField(env, obj, fid, 0);
SAFE_RELEASE(icc, iccBuf);
THROW_TJ();
}
(*env)->SetIntField(env, obj, fid, (int)iccSize);
bailout:
SAFE_RELEASE(icc, iccBuf);
}
static jint TJCompressor_compress
(JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint precision,
jint x, jint y, jint width, jint pitch, jint height, jint pf,
@@ -277,7 +309,7 @@ bailout:
return (jint)jpegSize;
}
/* TurboJPEG 3: TJCompressor.compress8() byte source */
/* TurboJPEG 3.0.x: TJCompressor.compress8() byte source */
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress8___3BIIIIII_3B
(JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width,
jint pitch, jint height, jint pf, jbyteArray dst)
@@ -286,7 +318,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress8___
pf, dst);
}
/* TurboJPEG 3: TJCompressor.compress12() */
/* TurboJPEG 3.0.x: TJCompressor.compress12() */
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress12
(JNIEnv *env, jobject obj, jshortArray src, jint x, jint y, jint width,
jint pitch, jint height, jint pf, jbyteArray dst)
@@ -295,7 +327,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress12
height, pf, dst);
}
/* TurboJPEG 3: TJCompressor.compress16() */
/* TurboJPEG 3.0.x: TJCompressor.compress16() */
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress16
(JNIEnv *env, jobject obj, jshortArray src, jint x, jint y, jint width,
jint pitch, jint height, jint pf, jbyteArray dst)
@@ -304,7 +336,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress16
height, pf, dst);
}
/* TurboJPEG 3: TJCompressor.compress8() int source */
/* TurboJPEG 3.0.x: TJCompressor.compress8() int source */
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress8___3IIIIIII_3B
(JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width,
jint stride, jint height, jint pf, jbyteArray dst)
@@ -321,7 +353,7 @@ bailout:
return 0;
}
/* TurboJPEG 3: TJCompressor.compressFromYUV8() */
/* TurboJPEG 3.0.x: TJCompressor.compressFromYUV8() */
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV8
(JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets,
jint width, jintArray jSrcStrides, jint height, jbyteArray dst)
@@ -499,7 +531,7 @@ bailout:
SAFE_RELEASE(jDstPlanes[i], dstPlanesTmp[i]);
}
/* TurboJPEG 3: TJCompressor.encodeYUV8() byte source */
/* TurboJPEG 3.0.x: TJCompressor.encodeYUV8() byte source */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV8___3BIIIIII_3_3B_3I_3I
(JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width,
jint pitch, jint height, jint pf, jobjectArray dstobjs,
@@ -509,7 +541,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV8__
dstobjs, jDstOffsets, jDstStrides);
}
/* TurboJPEG 3: TJCompressor.encodeYUV8() int source */
/* TurboJPEG 3.0.x: TJCompressor.encodeYUV8() int source */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV8___3IIIIIII_3_3B_3I_3I
(JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width,
jint stride, jint height, jint pf, jobjectArray dstobjs,
@@ -562,14 +594,14 @@ bailout:
return;
}
/* TurboJPEG 3: TJDecompressor.set() */
/* TurboJPEG 3.0.x: TJDecompressor.set() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_set
(JNIEnv *env, jobject obj, jint param, jint value)
{
Java_org_libjpegturbo_turbojpeg_TJCompressor_set(env, obj, param, value);
}
/* TurboJPEG 3: TJDecompressor.get() */
/* TurboJPEG 3.0.x: TJDecompressor.get() */
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_get
(JNIEnv *env, jobject obj, jint param)
{
@@ -630,7 +662,46 @@ bailout:
SAFE_RELEASE(src, jpegBuf);
}
/* TurboJPEG 3: TJDecompressor.setCroppingRegion() */
/* TurboJPEG 3.1.x: TJDecompressor.getICCProfile() */
JNIEXPORT jbyteArray JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_getICCProfile
(JNIEnv *env, jobject obj)
{
tjhandle handle = 0;
unsigned char *iccBuf = NULL, *jICCBuf = NULL;
size_t iccSize = 0;
jbyteArray icc = NULL;
GET_HANDLE();
if (tj3GetICCProfile(handle, &iccBuf, &iccSize) == -1)
THROW_TJ();
BAILIF0(icc = (*env)->NewByteArray(env, iccSize));
BAILIF0NOEC(jICCBuf = (*env)->GetPrimitiveArrayCritical(env, icc, 0));
memcpy(jICCBuf, iccBuf, iccSize);
bailout:
SAFE_RELEASE(icc, jICCBuf);
tj3Free(iccBuf);
return icc;
}
/* TurboJPEG 3.1.x: TJDecompressor.getICCSize() */
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_getICCSize
(JNIEnv *env, jobject obj)
{
tjhandle handle = 0;
size_t iccSize = 0;
GET_HANDLE();
tj3GetICCProfile(handle, NULL, &iccSize);
bailout:
return iccSize;
}
/* TurboJPEG 3.0.x: TJDecompressor.setCroppingRegion() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_setCroppingRegion
(JNIEnv *env, jobject obj)
{
@@ -780,7 +851,7 @@ bailout:
SAFE_RELEASE(src, jpegBuf);
}
/* TurboJPEG 3: TJDecompressor.decompress8() byte destination */
/* TurboJPEG 3.0.x: TJDecompressor.decompress8() byte destination */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress8___3BI_3BIIII
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
jint x, jint y, jint pitch, jint pf)
@@ -789,7 +860,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
pf);
}
/* TurboJPEG 3: TJDecompressor.decompress12() */
/* TurboJPEG 3.0.x: TJDecompressor.decompress12() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress12
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jshortArray dst,
jint x, jint y, jint pitch, jint pf)
@@ -798,7 +869,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
pf);
}
/* TurboJPEG 3: TJDecompressor.decompress16() */
/* TurboJPEG 3.0.x: TJDecompressor.decompress16() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress16
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jshortArray dst,
jint x, jint y, jint pitch, jint pf)
@@ -807,7 +878,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
pf);
}
/* TurboJPEG 3: TJDecompressor.decompress8() int destination */
/* TurboJPEG 3.0.x: TJDecompressor.decompress8() int destination */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress8___3BI_3IIIII
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jintArray dst,
jint x, jint y, jint stride, jint pf)
@@ -824,7 +895,7 @@ bailout:
return;
}
/* TurboJPEG 3: TJDecompressor.decompressToYUV8() */
/* TurboJPEG 3.0.x: TJDecompressor.decompressToYUV8() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV8
(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize,
jobjectArray dstobjs, jintArray jDstOffsets, jintArray jDstStrides)
@@ -1012,7 +1083,7 @@ bailout:
SAFE_RELEASE(jSrcPlanes[i], srcPlanesTmp[i]);
}
/* TurboJPEG 3: TJDecompressor.decodeYUV8() byte destination */
/* TurboJPEG 3.0.x: TJDecompressor.decodeYUV8() byte destination */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV8___3_3B_3I_3I_3BIIIIII
(JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets,
jintArray jSrcStrides, jbyteArray dst, jint x, jint y, jint width,
@@ -1022,7 +1093,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV8
1, x, y, width, pitch, height, pf);
}
/* TurboJPEG 3: TJDecompressor.decodeYUV8() int destination */
/* TurboJPEG 3.0.x: TJDecompressor.decodeYUV8() int destination */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV8___3_3B_3I_3I_3IIIIIII
(JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets,
jintArray jSrcStrides, jintArray dst, jint x, jint y, jint width,
@@ -1060,6 +1131,13 @@ bailout:
return;
}
/* TurboJPEG 3.1.x: TJTransformer.setICCProfile() */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_setICCProfile
(JNIEnv *env, jobject obj, jbyteArray icc)
{
Java_org_libjpegturbo_turbojpeg_TJCompressor_setICCProfile(env, obj, icc);
}
typedef struct _JNICustomFilterParams {
JNIEnv *env;
jobject tobj;