You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/01/05 19:43:21 UTC
(commons-imaging) branch master updated (233b5b2d -> 261b1e7b)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
from 233b5b2d Javadoc
new fe0cbd5b Javadoc
new eb79d179 Javadoc
new 53fcb473 Javadoc
new 737972fc Javadoc
new 9bc04047 Javadoc
new deac7889 Javadoc
new e226bdb2 Javadoc
new 04efa4ca Javadoc
new 88ae2f8d Javadoc
new 0b60d773 Javadoc
new 1ffafd68 Javadoc
new 911f4685 Javadoc
new a053dcd7 Javadoc
new 57f4554f Javadoc
new d3065790 Javadoc
new cecdcc8d Javadoc
new 261b1e7b GH CI no longer needs to disable doclint
The 17 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/maven.yml | 2 +-
.../imaging/common/AllocationRequestException.java | 2 +
.../imaging/common/XmpImagingParameters.java | 18 ++
.../imaging/formats/bmp/BmpImageParser.java | 2 +-
.../imaging/formats/dcx/DcxImageParser.java | 2 +-
.../imaging/formats/icns/IcnsImageParser.java | 2 +-
.../imaging/formats/ico/IcoImageParser.java | 2 +-
.../imaging/formats/jpeg/JpegImageMetadata.java | 44 ++-
.../imaging/formats/jpeg/JpegImageParser.java | 72 ++++-
.../commons/imaging/formats/jpeg/JpegUtils.java | 55 +++-
.../imaging/formats/jpeg/iptc/IptcParser.java | 4 +-
.../formats/jpeg/segments/UnknownSegment.java | 18 ++
.../imaging/formats/jpeg/xmp/JpegRewriter.java | 185 ++++++++++-
.../TransparencyFilterGrayscale.java | 9 +
.../TransparencyFilterIndexedColor.java | 8 +
.../TransparencyFilterTrueColor.java | 9 +
.../imaging/formats/pnm/PnmImageParser.java | 2 +-
.../imaging/formats/psd/PsdImageContents.java | 28 ++
.../imaging/formats/psd/PsdImageParser.java | 3 +
.../formats/psd/dataparsers/DataParserBitmap.java | 2 +-
.../formats/psd/dataparsers/DataParserCmyk.java | 2 +-
.../psd/dataparsers/DataParserGrayscale.java | 2 +-
.../formats/psd/dataparsers/DataParserIndexed.java | 2 +-
.../formats/psd/dataparsers/DataParserLab.java | 2 +-
.../formats/psd/dataparsers/DataParserRgb.java | 2 +-
.../psd/datareaders/UncompressedDataReader.java | 8 +
.../imaging/formats/rgbe/RgbeImageParser.java | 2 +-
.../formats/tiff/AbstractTiffImageData.java | 1 +
.../commons/imaging/formats/tiff/TiffContents.java | 39 +++
.../imaging/formats/tiff/TiffDirectory.java | 358 ++++++++++++++++++++-
.../commons/imaging/formats/tiff/TiffField.java | 140 +++++++-
.../commons/imaging/formats/tiff/TiffHeader.java | 27 ++
.../imaging/formats/tiff/TiffImageMetadata.java | 277 ++++++++++++++++
.../imaging/formats/tiff/TiffImageParser.java | 19 ++
.../formats/tiff/TiffImagingParameters.java | 74 +++++
.../commons/imaging/formats/tiff/TiffReader.java | 79 +++++
.../formats/tiff/constants/Tiff4TagConstants.java | 12 +
.../formats/tiff/constants/TiffConstants.java | 51 ++-
.../tiff/constants/TiffDirectoryConstants.java | 34 ++
.../formats/tiff/constants/TiffDirectoryType.java | 43 +++
.../formats/tiff/constants/TiffEpTagConstants.java | 46 +++
.../formats/tiff/constants/TiffTagConstants.java | 271 ++++++++++++++++
.../formats/tiff/constants/WangTagConstants.java | 2 +
.../formats/tiff/taginfos/TagInfoLongOrIfd.java | 7 +
.../formats/tiff/taginfos/TagInfoSRationals.java | 26 ++
.../formats/tiff/taginfos/TagInfoSShort.java | 25 ++
.../formats/tiff/taginfos/TagInfoSShorts.java | 26 ++
.../formats/tiff/taginfos/TagInfoUndefined.java | 11 +
.../formats/tiff/taginfos/TagInfoUndefineds.java | 12 +
.../formats/tiff/taginfos/TagInfoUnknown.java | 8 +
.../formats/tiff/taginfos/TagInfoUnknowns.java | 12 +
.../formats/tiff/taginfos/TagInfoXpString.java | 8 +
.../formats/tiff/write/AbstractTiffOutputItem.java | 30 ++
.../tiff/write/TiffImageWriterLossless.java | 11 +
.../formats/tiff/write/TiffImageWriterLossy.java | 11 +
.../formats/tiff/write/TiffOutputDirectory.java | 324 +++++++++++++++++++
.../formats/tiff/write/TiffOutputField.java | 77 +++++
.../imaging/formats/tiff/write/TiffOutputSet.java | 138 ++++++++
.../imaging/formats/wbmp/WbmpImageParser.java | 6 +
.../formats/wbmp/WbmpImagingParameters.java | 8 +-
.../imaging/formats/webp/WebPChunkType.java | 18 ++
.../formats/webp/WebPImagingParameters.java | 7 +
.../imaging/formats/webp/chunks/WebPChunkVp8.java | 10 +
.../imaging/formats/webp/chunks/WebPChunkVp8l.java | 8 +
.../imaging/formats/webp/chunks/WebPChunkVp8x.java | 14 +
.../imaging/formats/webp/chunks/WebPChunkXml.java | 2 +
.../imaging/formats/xbm/XbmImageParser.java | 6 +
.../imaging/formats/xbm/XbmImagingParameters.java | 8 +-
.../imaging/formats/xpm/XpmImageParser.java | 6 +
.../imaging/formats/xpm/XpmImagingParameters.java | 8 +-
.../commons/imaging/icc/IccProfileParser.java | 59 ++++
.../commons/imaging/mylzw/MyLzwCompressor.java | 61 ++++
72 files changed, 2865 insertions(+), 44 deletions(-)
(commons-imaging) 02/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit eb79d179dd02be8cc0920776ca4e7f21c3dd3cdc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 06:59:59 2026 -0500
Javadoc
---
.../imaging/formats/jpeg/JpegImageParser.java | 46 ++-
.../imaging/formats/jpeg/iptc/IptcParser.java | 2 +-
.../imaging/formats/jpeg/xmp/JpegRewriter.java | 21 ++
.../imaging/formats/psd/PsdImageParser.java | 3 +
.../commons/imaging/formats/tiff/TiffContents.java | 39 +++
.../imaging/formats/tiff/TiffDirectory.java | 355 ++++++++++++++++++++-
.../formats/tiff/constants/Tiff4TagConstants.java | 12 +
.../formats/tiff/constants/TiffConstants.java | 51 ++-
.../commons/imaging/icc/IccProfileParser.java | 14 +
9 files changed, 535 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
index fa6bc1a0..dc7cf05b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
@@ -689,6 +689,15 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
return "Jpeg-Custom";
}
+ /**
+ * Gets Photoshop metadata.
+ *
+ * @param byteSource the byte source.
+ * @param params the imaging parameters.
+ * @return the Photoshop metadata or null if not found.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public JpegPhotoshopMetadata getPhotoshopMetadata(final ByteSource byteSource, final JpegImagingParameters params) throws ImagingException, IOException {
final List<AbstractSegment> abstractSegments = readSegments(byteSource, new int[] { JpegConstants.JPEG_APP13_MARKER, }, false);
@@ -718,11 +727,12 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
/**
* Extracts embedded XML metadata as XML string.
- * <p>
*
* @param byteSource File containing image data.
* @param params Map of optional parameters, defined in ImagingConstants.
* @return Xmp Xml as String, if present. Otherwise, returns null.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
*/
@Override
public String getXmpXml(final ByteSource byteSource, final XmpImagingParameters<JpegImagingParameters> params) throws ImagingException, IOException {
@@ -768,6 +778,14 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
return result.get(0);
}
+ /**
+ * Checks if the image has an EXIF segment.
+ *
+ * @param byteSource the byte source.
+ * @return true if EXIF segment is present, false otherwise.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public boolean hasExifSegment(final ByteSource byteSource) throws ImagingException, IOException {
final boolean[] result = { false, };
@@ -805,6 +823,14 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
return result[0];
}
+ /**
+ * Checks if the image has an IPTC segment.
+ *
+ * @param byteSource the byte source.
+ * @return true if IPTC segment is present, false otherwise.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public boolean hasIptcSegment(final ByteSource byteSource) throws ImagingException, IOException {
final boolean[] result = { false, };
@@ -842,6 +868,14 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
return result[0];
}
+ /**
+ * Checks if the image has an XMP segment.
+ *
+ * @param byteSource the byte source.
+ * @return true if XMP segment is present, false otherwise.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public boolean hasXmpSegment(final ByteSource byteSource) throws ImagingException, IOException {
final boolean[] result = { false, };
@@ -882,6 +916,16 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
return ArrayUtils.contains(markers, marker);
}
+ /**
+ * Reads segments from JPEG image.
+ *
+ * @param byteSource the byte source.
+ * @param markers the markers to read.
+ * @param returnAfterFirst whether to return after first match.
+ * @return the list of segments.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public List<AbstractSegment> readSegments(final ByteSource byteSource, final int[] markers, final boolean returnAfterFirst)
throws ImagingException, IOException {
final List<AbstractSegment> result = new ArrayList<>();
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
index 71c7b356..855e06ff 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
@@ -372,7 +372,7 @@ public class IptcParser extends BinaryFileParser {
// private void writeIPTCRecord(BinaryOutputStream bos, )
- /*
+ /**
* In practice, App13 segments are only used for Photoshop/IPTC metadata. However, we should not treat App13 signatures without Photoshop's signature as
* Photoshop/IPTC segments.
*
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
index d69f34c9..790c0bd7 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
@@ -35,6 +35,10 @@ import org.apache.commons.imaging.formats.jpeg.iptc.IptcParser;
* Interface for Exif write/update/remove functionality for Jpeg/JFIF images.
*/
public class JpegRewriter extends BinaryFileParser {
+
+ /**
+ * Abstracts JFIF pieces.
+ */
protected abstract static class JFIFPiece {
@Override
public String toString() {
@@ -293,10 +297,27 @@ public class JpegRewriter extends BinaryFileParser {
return new JFIFPieces(pieces, segmentPieces);
}
+ /**
+ * Filters segments using a filter.
+ *
+ * @param <T> the piece type.
+ * @param segments the segments.
+ * @param filter the filter.
+ * @return the filtered segments.
+ */
protected <T extends JFIFPiece> List<T> filterSegments(final List<T> segments, final SegmentFilter filter) {
return filterSegments(segments, filter, false);
}
+ /**
+ * Filters segments using a filter with optional reverse logic.
+ *
+ * @param <T> the piece type.
+ * @param segments the segments.
+ * @param filter the filter.
+ * @param reverse whether to reverse the filter logic.
+ * @return the filtered segments.
+ */
protected <T extends JFIFPiece> List<T> filterSegments(final List<T> segments, final SegmentFilter filter, final boolean reverse) {
final List<T> result = new ArrayList<>();
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
index 90247d1e..007379b1 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
@@ -49,6 +49,9 @@ import org.apache.commons.imaging.formats.psd.datareaders.UncompressedDataReader
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
+/**
+ * Parses Adobe Photoshop PSD image files.
+ */
public class PsdImageParser extends AbstractImageParser<PsdImagingParameters> implements XmpEmbeddable {
private static final String DEFAULT_EXTENSION = ImageFormats.PSD.getDefaultExtension();
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java
index dec9f4b1..8588a0ac 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java
@@ -24,18 +24,44 @@ import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
import org.apache.commons.imaging.internal.Debug;
+/**
+ * The contents of a TIFF file including header, directories, and fields.
+ */
public class TiffContents {
+ /**
+ * The TIFF header.
+ */
public final TiffHeader header;
+
+ /**
+ * The list of TIFF directories.
+ */
public final List<TiffDirectory> directories;
+
+ /**
+ * The list of TIFF fields.
+ */
public final List<TiffField> tiffFields;
+ /**
+ * Constructs a new instance.
+ *
+ * @param tiffHeader the TIFF header.
+ * @param directories the list of directories.
+ * @param tiffFields the list of fields.
+ */
public TiffContents(final TiffHeader tiffHeader, final List<TiffDirectory> directories, final List<TiffField> tiffFields) {
this.header = tiffHeader;
this.directories = Collections.unmodifiableList(directories);
this.tiffFields = Collections.unmodifiableList(tiffFields);
}
+ /**
+ * Dissects the TIFF structure for debugging purposes.
+ *
+ * @throws ImagingException if an error occurs during dissection.
+ */
public void dissect() throws ImagingException {
final List<AbstractTiffElement> elements = getElements();
@@ -63,6 +89,13 @@ public class TiffContents {
Debug.debug();
}
+ /**
+ * Finds a field by tag.
+ *
+ * @param tag the tag to search for.
+ * @return the field, or null if not found.
+ * @throws ImagingException if an error occurs during search.
+ */
public TiffField findField(final TagInfo tag) throws ImagingException {
for (final TiffDirectory directory : directories) {
final TiffField field = directory.findField(tag);
@@ -74,6 +107,12 @@ public class TiffContents {
return null;
}
+ /**
+ * Gets all TIFF elements including header, directories, and field data.
+ *
+ * @return the list of elements.
+ * @throws ImagingException if an error occurs.
+ */
public List<AbstractTiffElement> getElements() throws ImagingException {
final List<AbstractTiffElement> result = new ArrayList<>();
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
index d08138d5..0b7fa4df 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
@@ -65,6 +65,13 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoXpString;
public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffField> {
public static final class ImageDataElement extends AbstractTiffElement {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param offset the offset.
+ * @param length the length.
+ */
public ImageDataElement(final long offset, final int length) {
super(offset, length);
}
@@ -75,6 +82,12 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
}
}
+ /**
+ * Gets a description for a directory type.
+ *
+ * @param type the directory type.
+ * @return the description.
+ */
public static String description(final int type) {
switch (type) {
case TiffDirectoryConstants.DIRECTORY_TYPE_UNKNOWN:
@@ -104,14 +117,35 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
*/
private final ByteOrder headerByteOrder;
+ /**
+ * JPEG image data if present.
+ */
private JpegImageData jpegImageData;
+ /**
+ * Offset to the next directory.
+ */
private final long nextDirectoryOffset;
+ /**
+ * TIFF image data if present.
+ */
private AbstractTiffImageData abstractTiffImageData;
+ /**
+ * The directory type.
+ */
public final int type;
+ /**
+ * Constructs a new instance.
+ *
+ * @param type the directory type.
+ * @param entries the list of fields.
+ * @param offset the offset.
+ * @param nextDirectoryOffset the next directory offset.
+ * @param byteOrder the byte order.
+ */
public TiffDirectory(final int type, final List<TiffField> entries, final long offset, final long nextDirectoryOffset, final ByteOrder byteOrder) {
super(offset,
TiffConstants.DIRECTORY_HEADER_LENGTH + entries.size() * TiffConstants.ENTRY_LENGTH + TiffConstants.DIRECTORY_FOOTER_LENGTH);
@@ -122,19 +156,42 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
this.headerByteOrder = byteOrder;
}
+ /**
+ * Gets a description of this directory's type.
+ *
+ * @return the description.
+ */
public String description() {
return description(type);
}
+ /**
+ * Dumps all field information for debugging.
+ */
public void dump() {
entries.forEach(TiffField::dump);
}
+ /**
+ * Finds a field by tag.
+ *
+ * @param tag the tag to search for.
+ * @return the field, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public TiffField findField(final TagInfo tag) throws ImagingException {
final boolean failIfMissing = false;
return findField(tag, failIfMissing);
}
+ /**
+ * Finds a field by tag.
+ *
+ * @param tag the tag to search for.
+ * @param failIfMissing whether to throw an exception if not found.
+ * @return the field, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and failIfMissing is true.
+ */
public TiffField findField(final TagInfo tag, final boolean failIfMissing) throws ImagingException {
for (final TiffField field : entries) {
if (field.getTag() == tag.tag) {
@@ -158,6 +215,11 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return headerByteOrder;
}
+ /**
+ * Gets a copy of all directory entries.
+ *
+ * @return the list of fields.
+ */
public List<TiffField> getDirectoryEntries() {
return new ArrayList<>(entries);
}
@@ -176,6 +238,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return result.toString();
}
+ /**
+ * Gets the value of a field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public Object getFieldValue(final TagInfo tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -184,6 +253,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return field.getValue();
}
+ /**
+ * Gets the value of an ASCII field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public String[] getFieldValue(final TagInfoAscii tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -202,6 +279,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a byte field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public byte getFieldValue(final TagInfoByte tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -216,6 +300,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return field.getByteArrayValue()[0];
}
+ /**
+ * Gets the value of a bytes field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public byte[] getFieldValue(final TagInfoBytes tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -233,6 +325,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return field.getByteArrayValue();
}
+ /**
+ * Gets the value of a double field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public double getFieldValue(final TagInfoDouble tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -248,6 +347,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a doubles field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public double[] getFieldValue(final TagInfoDoubles tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -266,6 +373,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a float field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public float getFieldValue(final TagInfoFloat tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -281,6 +395,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a floats field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public float[] getFieldValue(final TagInfoFloats tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -299,6 +421,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a GPS text field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public String getFieldValue(final TagInfoGpsText tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -307,9 +437,22 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
}
return null;
}
+ if (!tag.dataTypes.contains(field.getFieldType())) {
+ if (mustExist) {
+ throw new ImagingException("Required field \"" + tag.name + "\" has incorrect type " + field.getFieldType().getName());
+ }
+ return null;
+ }
return tag.getValue(field);
}
+ /**
+ * Gets the value of a long field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public int getFieldValue(final TagInfoLong tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -325,6 +468,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a longs field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public int[] getFieldValue(final TagInfoLongs tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -343,6 +494,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a rational field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public RationalNumber getFieldValue(final TagInfoRational tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -358,6 +516,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a rationals field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public RationalNumber[] getFieldValue(final TagInfoRationals tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -376,6 +542,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed byte field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public byte getFieldValue(final TagInfoSByte tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -390,6 +563,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return field.getByteArrayValue()[0];
}
+ /**
+ * Gets the value of a signed bytes field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public byte[] getFieldValue(final TagInfoSBytes tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -407,6 +588,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return field.getByteArrayValue();
}
+ /**
+ * Gets the value of a short field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public short getFieldValue(final TagInfoShort tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -422,6 +610,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a short or long field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public int[] getFieldValue(final TagInfoShortOrLong tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -443,6 +639,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return ByteConversions.toInts(bytes, field.getByteOrder());
}
+ /**
+ * Gets the value of a shorts field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public short[] getFieldValue(final TagInfoShorts tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -461,6 +665,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed long field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public int getFieldValue(final TagInfoSLong tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -476,6 +687,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed longs field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public int[] getFieldValue(final TagInfoSLongs tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -494,6 +713,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed rational field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public RationalNumber getFieldValue(final TagInfoSRational tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -509,6 +735,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed rationals field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public RationalNumber[] getFieldValue(final TagInfoSRationals tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -527,6 +761,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed short field.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public short getFieldValue(final TagInfoSShort tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -542,6 +783,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed shorts field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public short[] getFieldValue(final TagInfoSShorts tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -560,6 +809,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of an XP string field.
+ *
+ * @param tag the tag.
+ * @param mustExist whether the field must exist.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs or field is missing and mustExist is true.
+ */
public String getFieldValue(final TagInfoXpString tag, final boolean mustExist) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -568,13 +825,30 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
}
return null;
}
+ if (!tag.dataTypes.contains(field.getFieldType())) {
+ if (mustExist) {
+ throw new ImagingException("Required field \"" + tag.name + "\" has incorrect type " + field.getFieldType().getName());
+ }
+ return null;
+ }
return tag.getValue(field);
}
+ /**
+ * Gets the JPEG image data.
+ *
+ * @return the JPEG image data, or null if not available.
+ */
public JpegImageData getJpegImageData() {
return jpegImageData;
}
+ /**
+ * Gets the JPEG raw image data element.
+ *
+ * @return the image data element.
+ * @throws ImagingException if an error occurs.
+ */
public ImageDataElement getJpegRawImageDataElement() throws ImagingException {
final TiffField jpegInterchangeFormat = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT);
final TiffField jpegInterchangeFormatLength = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH);
@@ -588,6 +862,11 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
throw new ImagingException("Couldn't find image data.");
}
+ /**
+ * Gets the offset to the next directory.
+ *
+ * @return the next directory offset.
+ */
public long getNextDirectoryOffset() {
return nextDirectoryOffset;
}
@@ -599,9 +878,11 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
* TIFF directories that provide numerical data do not directly specify images, though it is possible to interpret the data as an image using this library.
* TIFF files may contain multiple directories which are allowed to have different formats. Thus it is possible for a TIFF file to contain a mix of image
* and floating-point raster data.
+ * </p>
* <p>
* If desired, sub-image data can be read from the file by using a Java Map instance to specify the subsection of the image that is required. The following
* code illustrates the approach:
+ * </p>
*
* <pre>
* int x; // coordinate (column) of corner of sub-image
@@ -617,10 +898,10 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
* TiffRasterData raster = directory.readFloatingPointRasterData(params);
* </pre>
*
- * @param params an optional parameter map instance
- * @return a valid instance
- * @throws ImagingException in the event of incompatible or malformed data
- * @throws IOException in the event of an I/O error
+ * @param params an optional parameter map instance.
+ * @return a valid instance.
+ * @throws ImagingException in the event of incompatible or malformed data.
+ * @throws IOException in the event of an I/O error.
*/
public AbstractTiffRasterData getRasterData(final TiffImagingParameters params) throws ImagingException, IOException {
@@ -628,6 +909,14 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return parser.getRasterData(this, headerByteOrder, params);
}
+ /**
+ * Gets raw image data elements from offset and byte count fields.
+ *
+ * @param offsetsField the offsets field.
+ * @param byteCountsField the byte counts field.
+ * @return the list of image data elements.
+ * @throws ImagingException if an error occurs.
+ */
private List<ImageDataElement> getRawImageDataElements(final TiffField offsetsField, final TiffField byteCountsField) throws ImagingException {
final long[] offsets = offsetsField.getLongArrayValue();
final int[] byteCounts = byteCountsField.getIntArrayValue();
@@ -643,6 +932,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return result;
}
+ /**
+ * Gets a single ASCII field value.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public String getSingleFieldValue(final TagInfoAscii tag) throws ImagingException {
final String[] result = getFieldValue(tag, true);
if (result.length != 1) {
@@ -651,6 +947,13 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return result[0];
}
+ /**
+ * Gets a single short or long field value.
+ *
+ * @param tag the tag.
+ * @return the field value.
+ * @throws ImagingException if an error occurs or field is missing.
+ */
public int getSingleFieldValue(final TagInfoShortOrLong tag) throws ImagingException {
final int[] result = getFieldValue(tag, true);
if (result.length != 1) {
@@ -728,10 +1031,21 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return new TiffImageParser().getBufferedImage(this, headerByteOrder, params);
}
+ /**
+ * Gets the TIFF image data.
+ *
+ * @return the TIFF image data, or null if not available.
+ */
public AbstractTiffImageData getTiffImageData() {
return abstractTiffImageData;
}
+ /**
+ * Gets the raw TIFF image data elements.
+ *
+ * @return the list of image data elements.
+ * @throws ImagingException if an error occurs.
+ */
public List<ImageDataElement> getTiffRawImageDataElements() throws ImagingException {
final TiffField tileOffsets = findField(TiffTagConstants.TIFF_TAG_TILE_OFFSETS);
final TiffField tileByteCounts = findField(TiffTagConstants.TIFF_TAG_TILE_BYTE_COUNTS);
@@ -747,6 +1061,12 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
throw new ImagingException("Couldn't find image data.");
}
+ /**
+ * Checks if this directory has JPEG image data.
+ *
+ * @return true if JPEG image data is present, false otherwise.
+ * @throws ImagingException if an error occurs.
+ */
public boolean hasJpegImageData() throws ImagingException {
return null != findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT);
}
@@ -766,6 +1086,12 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
}
+ /**
+ * Checks if this directory has TIFF image data.
+ *
+ * @return true if TIFF image data is present, false otherwise.
+ * @throws ImagingException if an error occurs.
+ */
public boolean hasTiffImageData() throws ImagingException {
if (null != findField(TiffTagConstants.TIFF_TAG_TILE_OFFSETS)) {
return true;
@@ -790,6 +1116,12 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
|| s[0] == TiffTagConstants.SAMPLE_FORMAT_VALUE_TWOS_COMPLEMENT_SIGNED_INTEGER);
}
+ /**
+ * Checks if image data is stored in strips (as opposed to tiles).
+ *
+ * @return true if data is in strips, false if in tiles.
+ * @throws ImagingException if an error occurs.
+ */
public boolean imageDataInStrips() throws ImagingException {
final TiffField tileOffsets = findField(TiffTagConstants.TIFF_TAG_TILE_OFFSETS);
final TiffField tileByteCounts = findField(TiffTagConstants.TIFF_TAG_TILE_BYTE_COUNTS);
@@ -810,14 +1142,29 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
return entries.iterator();
}
+ /**
+ * Sets the JPEG image data.
+ *
+ * @param value the JPEG image data.
+ */
public void setJpegImageData(final JpegImageData value) {
this.jpegImageData = value;
}
+ /**
+ * Sets the TIFF image data.
+ *
+ * @param rawImageData the TIFF image data.
+ */
public void setTiffImageData(final AbstractTiffImageData rawImageData) {
this.abstractTiffImageData = rawImageData;
}
+ /**
+ * Gets the number of fields in this directory.
+ *
+ * @return the number of fields.
+ */
public int size() {
return entries.size();
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Tiff4TagConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Tiff4TagConstants.java
index dd220233..c102df31 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Tiff4TagConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Tiff4TagConstants.java
@@ -31,13 +31,25 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShort;
*/
public final class Tiff4TagConstants {
+ /** TIFF tag for color response unit. */
public static final TagInfoShort TIFF_TAG_COLOR_RESPONSE_UNIT = new TagInfoShort("ColorResponseUnit", 0x12C, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Color response unit value 0.1. */
public static final int COLOR_RESPONSE_UNIT_VALUE_0_1 = 1;
+
+ /** Color response unit value 0.01. */
public static final int COLOR_RESPONSE_UNIT_VALUE_0_01 = 2;
+
+ /** Color response unit value 0.001. */
public static final int COLOR_RESPONSE_UNIT_VALUE_0_001 = 3;
+
+ /** Color response unit value 0.0001. */
public static final int COLOR_RESPONSE_UNIT_VALUE_0_0001 = 4;
+
+ /** Color response unit value 0.00001. */
public static final int COLOR_RESPONSE_UNIT_VALUE_0_00001 = 5;
+ /** List of all TIFF 4 tags. */
public static final List<TagInfo> ALL_TIFF_4_TAGS = Collections.unmodifiableList(Arrays.<TagInfo>asList(TIFF_TAG_COLOR_RESPONSE_UNIT));
private Tiff4TagConstants() {
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java
index 672f87e4..0428a014 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java
@@ -23,46 +23,93 @@ import java.nio.ByteOrder;
*/
public final class TiffConstants {
+ /** Default TIFF byte order (little-endian). */
public static final ByteOrder DEFAULT_TIFF_BYTE_ORDER = ByteOrder.LITTLE_ENDIAN;
+ /** TIFF standard version number. */
public static final int VERSION_STANDARD = 42;
+
+ /** TIFF big version number. */
public static final int VERSION_BIG = 43;
+ /** TIFF header size. */
public static final int HEADER_SIZE = 8;
+
+ /** TIFF directory header length. */
public static final int DIRECTORY_HEADER_LENGTH = 2;
+
+ /** TIFF directory footer length. */
public static final int DIRECTORY_FOOTER_LENGTH = 4;
+
+ /** TIFF entry length. */
public static final int ENTRY_LENGTH = 12;
+
+ /** TIFF entry maximum value length. */
public static final int ENTRY_MAX_VALUE_LENGTH = 4;
+
+ /** TIFF big entry length. */
public static final int ENTRY_LENGTH_BIG = 12;
+
+ /** TIFF big entry maximum value length. */
public static final int ENTRY_MAX_VALUE_LENGTH_BIG = 8;
+ /** Compression type: uncompressed (1). */
public static final int COMPRESSION_UNCOMPRESSED_1 = 1;
+
+ /** Compression type: uncompressed (alias). */
public static final int COMPRESSION_UNCOMPRESSED = COMPRESSION_UNCOMPRESSED_1;
+
+ /** Compression type: CCITT 1D. */
public static final int COMPRESSION_CCITT_1D = 2;
+
+ /** Compression type: CCITT Group 3. */
public static final int COMPRESSION_CCITT_GROUP_3 = 3;
+
+ /** Compression type: CCITT Group 4. */
public static final int COMPRESSION_CCITT_GROUP_4 = 4;
+
+ /** Compression type: LZW. */
public static final int COMPRESSION_LZW = 5;
+
+ /** Compression type: JPEG (obsolete). */
public static final int COMPRESSION_JPEG_OBSOLETE = 6;
+
+ /** Compression type: JPEG. */
public static final int COMPRESSION_JPEG = 7;
+
+ /** Compression type: uncompressed (2). */
public static final int COMPRESSION_UNCOMPRESSED_2 = 32771;
+
+ /** Compression type: PackBits. */
public static final int COMPRESSION_PACKBITS = 32773;
+
+ /** Compression type: Deflate (PKZIP). */
public static final int COMPRESSION_DEFLATE_PKZIP = 32946;
+
+ /** Compression type: Deflate (Adobe). */
public static final int COMPRESSION_DEFLATE_ADOBE = 8;
+ /** T4 options flag: 2D encoding. */
public static final int FLAG_T4_OPTIONS_2D = 1;
+
+ /** T4 options flag: uncompressed mode. */
public static final int FLAG_T4_OPTIONS_UNCOMPRESSED_MODE = 2;
+
+ /** T4 options flag: fill. */
public static final int FLAG_T4_OPTIONS_FILL = 4;
+
+ /** T6 options flag: uncompressed mode. */
public static final int FLAG_T6_OPTIONS_UNCOMPRESSED_MODE = 2;
/**
* Specifies a larger strip-size to be used for compression. This setting generally produces smaller output files, but requires a slightly longer processing
- * time. Used in conjunction with the PARAM_KEY_LZW_COMPRESSION_STRIP_SIZE
+ * time. Used in conjunction with the PARAM_KEY_LZW_COMPRESSION_STRIP_SIZE.
*/
public static final int LZW_COMPRESSION_BLOCK_SIZE_MEDIUM = 32768;
/**
* Specifies a larger strip-size to be used for compression. This setting generally produces smaller output files, but requires a slightly longer processing
- * time. Used in conjunction with the PARAM_KEY_LZW_COMPRESSION_STRIP_SIZE
+ * time. Used in conjunction with the PARAM_KEY_LZW_COMPRESSION_STRIP_SIZE.
*/
public static final int LZW_COMPRESSION_BLOCK_SIZE_LARGE = 65536;
diff --git a/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java b/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
index 35d91d85..74a096db 100644
--- a/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
+++ b/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
@@ -177,10 +177,24 @@ public class IccProfileParser extends BinaryFileParser {
}
}
+ /**
+ * Checks if the ICC profile from file is sRGB.
+ *
+ * @param file the file.
+ * @return true if sRGB, false otherwise.
+ * @throws IOException if an I/O error occurs.
+ */
public boolean isSrgb(final File file) throws IOException {
return isSrgb(ByteSource.file(file));
}
+ /**
+ * Checks if the ICC_Profile is sRGB.
+ *
+ * @param iccProfile the ICC profile.
+ * @return true if sRGB, false otherwise.
+ * @throws IOException if an I/O error occurs.
+ */
public boolean isSrgb(final ICC_Profile iccProfile) throws IOException {
return isSrgb(ByteSource.array(iccProfile.getData()));
}
(commons-imaging) 12/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 911f468567e41414564b4edda10a8b1732216234
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:48 2026 -0500
Javadoc
---
.../commons/imaging/formats/webp/chunks/WebPChunkVp8.java | 10 ++++++++++
.../commons/imaging/formats/webp/chunks/WebPChunkVp8l.java | 8 ++++++++
.../commons/imaging/formats/webp/chunks/WebPChunkVp8x.java | 14 ++++++++++++++
.../commons/imaging/formats/webp/chunks/WebPChunkXml.java | 2 ++
4 files changed, 34 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8.java
index 4a5a3050..55349c05 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8.java
@@ -130,6 +130,8 @@ public final class WebPChunkVp8 extends AbstractWebPChunk {
}
/**
+ * Gets the height of the image.
+ *
* @return the height.
*/
public int getHeight() {
@@ -137,6 +139,8 @@ public final class WebPChunkVp8 extends AbstractWebPChunk {
}
/**
+ * Gets the horizontal scale.
+ *
* @return the horizontal scale.
*/
public int getHorizontalScale() {
@@ -144,6 +148,8 @@ public final class WebPChunkVp8 extends AbstractWebPChunk {
}
/**
+ * Gets the version number.
+ *
* @return the version number.
*/
public int getVersionNumber() {
@@ -151,6 +157,8 @@ public final class WebPChunkVp8 extends AbstractWebPChunk {
}
/**
+ * Gets the vertical scale.
+ *
* @return the vertical scale.
*/
public int getVerticalScale() {
@@ -158,6 +166,8 @@ public final class WebPChunkVp8 extends AbstractWebPChunk {
}
/**
+ * Gets the width of the image.
+ *
* @return the width.
*/
public int getWidth() {
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8l.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8l.java
index 4ae1561b..fd02273a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8l.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8l.java
@@ -85,6 +85,8 @@ public final class WebPChunkVp8l extends AbstractWebPChunk {
}
/**
+ * Gets the image height.
+ *
* @return the image height.
*/
public int getImageHeight() {
@@ -92,6 +94,8 @@ public final class WebPChunkVp8l extends AbstractWebPChunk {
}
/**
+ * Gets the image width.
+ *
* @return the image width.
*/
public int getImageWidth() {
@@ -99,6 +103,8 @@ public final class WebPChunkVp8l extends AbstractWebPChunk {
}
/**
+ * Gets the version number.
+ *
* @return the version number.
*/
public int getVersionNumber() {
@@ -106,6 +112,8 @@ public final class WebPChunkVp8l extends AbstractWebPChunk {
}
/**
+ * Checks whether the image has an alpha channel.
+ *
* @return whether the image has an alpha channel or not.
*/
public boolean hasAlpha() {
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8x.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8x.java
index 6cdb9a10..fb008d13 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8x.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8x.java
@@ -98,6 +98,8 @@ public final class WebPChunkVp8x extends AbstractWebPChunk {
}
/**
+ * Gets the canvas height.
+ *
* @return the canvas height.
*/
public int getCanvasHeight() {
@@ -105,6 +107,8 @@ public final class WebPChunkVp8x extends AbstractWebPChunk {
}
/**
+ * Gets the canvas width.
+ *
* @return the canvas width.
*/
public int getCanvasWidth() {
@@ -112,6 +116,8 @@ public final class WebPChunkVp8x extends AbstractWebPChunk {
}
/**
+ * Checks whether the chunk has alpha enabled.
+ *
* @return whether the chunk has alpha enabled.
*/
public boolean hasAlpha() {
@@ -119,6 +125,8 @@ public final class WebPChunkVp8x extends AbstractWebPChunk {
}
/**
+ * Checks if the chunk contains an animation.
+ *
* @return if the chunk contains an animation.
*/
public boolean hasAnimation() {
@@ -126,6 +134,8 @@ public final class WebPChunkVp8x extends AbstractWebPChunk {
}
/**
+ * Checks whether the chunk has EXIF data.
+ *
* @return whether the chunk has EXIF data.
*/
public boolean hasExif() {
@@ -133,6 +143,8 @@ public final class WebPChunkVp8x extends AbstractWebPChunk {
}
/**
+ * Checks whether the chunk has ICC enabled.
+ *
* @return whether the chunk has ICC enabled.
*/
public boolean hasIcc() {
@@ -140,6 +152,8 @@ public final class WebPChunkVp8x extends AbstractWebPChunk {
}
/**
+ * Checks whether the chunk has XMP.
+ *
* @return whether the chunk has XMP.
*/
public boolean hasXmp() {
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXml.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXml.java
index 49fbcf33..94210ee8 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXml.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXml.java
@@ -54,6 +54,8 @@ public final class WebPChunkXml extends AbstractWebPChunk {
}
/**
+ * Gets the XML content.
+ *
* @return the XML.
*/
public String getXml() {
(commons-imaging) 14/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 57f4554f2a916a045b716e302c8d4998be00a268
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:58 2026 -0500
Javadoc
---
.../java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index ff6111b1..5ca76c33 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -46,8 +46,14 @@ import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.BasicCParser;
import org.apache.commons.imaging.common.ImageMetadata;
+/**
+ * Parser for X BitMap (XBM) image format.
+ */
public class XbmImageParser extends AbstractImageParser<XbmImagingParameters> {
+ /**
+ * XBM header structure.
+ */
private static final class XbmHeader {
final int height;
final int width;
(commons-imaging) 04/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 737972fc4a4048ff54644d290052455790d60dde
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:09:55 2026 -0500
Javadoc
---
.../commons/imaging/common/AllocationRequestException.java | 2 ++
.../apache/commons/imaging/common/XmpImagingParameters.java | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/common/AllocationRequestException.java b/src/main/java/org/apache/commons/imaging/common/AllocationRequestException.java
index 217158b2..a824e454 100644
--- a/src/main/java/org/apache/commons/imaging/common/AllocationRequestException.java
+++ b/src/main/java/org/apache/commons/imaging/common/AllocationRequestException.java
@@ -32,8 +32,10 @@ public class AllocationRequestException extends ImagingRuntimeException {
return String.format("Allocation limit %,d exceeded: %,d", limit, request);
}
+ /** The allocation limit. */
private final int limit;
+ /** The allocation request. */
private final BigInteger request;
/**
diff --git a/src/main/java/org/apache/commons/imaging/common/XmpImagingParameters.java b/src/main/java/org/apache/commons/imaging/common/XmpImagingParameters.java
index 3a8a33f4..a8b393c4 100644
--- a/src/main/java/org/apache/commons/imaging/common/XmpImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/common/XmpImagingParameters.java
@@ -29,10 +29,21 @@ public class XmpImagingParameters<E extends XmpImagingParameters<E>> extends Ima
private String xmpXml;
+ /**
+ * Gets the XMP XML.
+ *
+ * @return the XMP XML.
+ */
public String getXmpXml() {
return xmpXml;
}
+ /**
+ * Sets the XMP XML.
+ *
+ * @param xmpXml the XMP XML.
+ * @return this instance.
+ */
public E setXmpXml(final String xmpXml) {
this.xmpXml = xmpXml;
return asThis();
(commons-imaging) 10/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 0b60d77312fb8f69874485f1f8819a5c42c36d4b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:34 2026 -0500
Javadoc
---
.../formats/tiff/AbstractTiffImageData.java | 1 +
.../imaging/formats/tiff/TiffImageMetadata.java | 235 +++++++++++++++++++++
.../imaging/formats/tiff/TiffImageParser.java | 19 ++
.../formats/tiff/TiffImagingParameters.java | 67 ++++++
.../commons/imaging/formats/tiff/TiffReader.java | 79 +++++++
5 files changed, 401 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffImageData.java b/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffImageData.java
index c53889e1..beb0767c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffImageData.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffImageData.java
@@ -62,6 +62,7 @@ public abstract class AbstractTiffImageData {
private final AbstractTiffElement.DataElement[] strips;
// public final byte strips[][];
+
/** The number of rows per strip. */
public final int rowsPerStrip;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
index dd68bc05..8778c42e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
@@ -78,22 +78,51 @@ public class TiffImageMetadata extends GenericImageMetadata {
this.byteOrder = byteOrder;
}
+ /**
+ * Adds a TIFF field as a metadata item.
+ *
+ * @param entry the TIFF field to add.
+ */
public void add(final TiffField entry) {
add(new TiffMetadataItem(entry));
}
+ /**
+ * Finds a field by tag.
+ *
+ * @param tagInfo the tag information.
+ * @return the field, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public TiffField findField(final TagInfo tagInfo) throws ImagingException {
return directory.findField(tagInfo);
}
+ /**
+ * Gets all fields in this directory.
+ *
+ * @return the list of fields.
+ */
public List<TiffField> getAllFields() {
return directory.getDirectoryEntries();
}
+ /**
+ * Gets JPEG image data if present.
+ *
+ * @return the JPEG image data, or null.
+ */
public JpegImageData getJpegImageData() {
return directory.getJpegImageData();
}
+ /**
+ * Gets the output directory for writing.
+ *
+ * @param byteOrder the byte order to use.
+ * @return the output directory.
+ * @throws ImagingException if an error occurs.
+ */
public TiffOutputDirectory getOutputDirectory(final ByteOrder byteOrder) throws ImagingException {
try {
final TiffOutputDirectory dstDir = new TiffOutputDirectory(type, byteOrder);
@@ -175,17 +204,63 @@ public class TiffImageMetadata extends GenericImageMetadata {
}
+ /**
+ * Contains GPS location information from TIFF metadata.
+ */
public static class GpsInfo {
+
+ /**
+ * Latitude reference (N or S).
+ */
public final String latitudeRef;
+
+ /**
+ * Longitude reference (E or W).
+ */
public final String longitudeRef;
+ /**
+ * Latitude degrees.
+ */
public final RationalNumber latitudeDegrees;
+
+ /**
+ * Latitude minutes.
+ */
public final RationalNumber latitudeMinutes;
+
+ /**
+ * Latitude seconds.
+ */
public final RationalNumber latitudeSeconds;
+
+ /**
+ * Longitude degrees.
+ */
public final RationalNumber longitudeDegrees;
+
+ /**
+ * Longitude minutes.
+ */
public final RationalNumber longitudeMinutes;
+
+ /**
+ * Longitude seconds.
+ */
public final RationalNumber longitudeSeconds;
+ /**
+ * Constructs a new instance.
+ *
+ * @param latitudeRef the latitude reference.
+ * @param longitudeRef the longitude reference.
+ * @param latitudeDegrees the latitude degrees.
+ * @param latitudeMinutes the latitude minutes.
+ * @param latitudeSeconds the latitude seconds.
+ * @param longitudeDegrees the longitude degrees.
+ * @param longitudeMinutes the longitude minutes.
+ * @param longitudeSeconds the longitude seconds.
+ */
public GpsInfo(final String latitudeRef, final String longitudeRef, final RationalNumber latitudeDegrees, final RationalNumber latitudeMinutes,
final RationalNumber latitudeSeconds, final RationalNumber longitudeDegrees, final RationalNumber longitudeMinutes,
final RationalNumber longitudeSeconds) {
@@ -199,6 +274,12 @@ public class TiffImageMetadata extends GenericImageMetadata {
this.longitudeSeconds = longitudeSeconds;
}
+ /**
+ * Gets the latitude as degrees north.
+ *
+ * @return the latitude in degrees north (negative for south).
+ * @throws ImagingException if the latitude reference is invalid.
+ */
public double getLatitudeAsDegreesNorth() throws ImagingException {
final double result = latitudeDegrees.doubleValue() + latitudeMinutes.doubleValue() / 60.0 + latitudeSeconds.doubleValue() / 3600.0;
@@ -260,18 +341,37 @@ public class TiffImageMetadata extends GenericImageMetadata {
this.entry = entry;
}
+ /**
+ * Gets the TIFF field.
+ *
+ * @return the TIFF field.
+ */
public TiffField getTiffField() {
return entry;
}
}
+ /**
+ * The TIFF contents.
+ */
public final TiffContents contents;
+ /**
+ * Constructs a new instance.
+ *
+ * @param contents the TIFF contents.
+ */
public TiffImageMetadata(final TiffContents contents) {
this.contents = contents;
}
+ /**
+ * Finds a directory by type.
+ *
+ * @param directoryType the directory type.
+ * @return the directory, or null if not found.
+ */
public TiffDirectory findDirectory(final int directoryType) {
final List<? extends ImageMetadataItem> directories = getDirectories();
for (final ImageMetadataItem directory1 : directories) {
@@ -283,10 +383,25 @@ public class TiffImageMetadata extends GenericImageMetadata {
return null;
}
+ /**
+ * Finds a field by tag.
+ *
+ * @param tagInfo the tag information.
+ * @return the field, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public TiffField findField(final TagInfo tagInfo) throws ImagingException {
return findField(tagInfo, false);
}
+ /**
+ * Finds a field by tag with directory matching option.
+ *
+ * @param tagInfo the tag information.
+ * @param exactDirectoryMatch whether to require exact directory match.
+ * @return the field, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public TiffField findField(final TagInfo tagInfo, final boolean exactDirectoryMatch) throws ImagingException {
// Please keep this method in sync with TiffField's getTag()
final Integer tagCount = TiffTags.getTagCount(tagInfo.tag);
@@ -328,6 +443,11 @@ public class TiffImageMetadata extends GenericImageMetadata {
return null;
}
+ /**
+ * Gets all fields from all directories.
+ *
+ * @return the list of all fields.
+ */
public List<TiffField> getAllFields() {
final List<TiffField> result = new ArrayList<>();
final List<? extends ImageMetadataItem> directories = getDirectories();
@@ -338,10 +458,22 @@ public class TiffImageMetadata extends GenericImageMetadata {
return result;
}
+ /**
+ * Gets all directories.
+ *
+ * @return the list of directories.
+ */
public List<? extends ImageMetadataItem> getDirectories() {
return super.getItems();
}
+ /**
+ * Gets the value of a field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public Object getFieldValue(final TagInfo tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -350,6 +482,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return field.getValue();
}
+ /**
+ * Gets the value of an ASCII field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public String[] getFieldValue(final TagInfoAscii tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -362,6 +501,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a byte field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public byte[] getFieldValue(final TagInfoByte tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -373,6 +519,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return field.getByteArrayValue();
}
+ /**
+ * Gets the value of a doubles field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public double[] getFieldValue(final TagInfoDoubles tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -385,6 +538,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a floats field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public float[] getFieldValue(final TagInfoFloats tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -397,6 +557,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a GPS text field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public String getFieldValue(final TagInfoGpsText tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -405,6 +572,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field);
}
+ /**
+ * Gets the value of a longs field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public int[] getFieldValue(final TagInfoLongs tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -417,6 +591,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a rationals field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public RationalNumber[] getFieldValue(final TagInfoRationals tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -429,6 +610,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed bytes field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public byte[] getFieldValue(final TagInfoSBytes tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -440,6 +628,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return field.getByteArrayValue();
}
+ /**
+ * Gets the value of a shorts field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public short[] getFieldValue(final TagInfoShorts tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -452,6 +647,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed longs field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public int[] getFieldValue(final TagInfoSLongs tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -464,6 +666,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed rationals field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public RationalNumber[] getFieldValue(final TagInfoSRationals tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -476,6 +685,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of a signed shorts field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public short[] getFieldValue(final TagInfoSShorts tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -488,6 +704,13 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field.getByteOrder(), bytes);
}
+ /**
+ * Gets the value of an XP string field.
+ *
+ * @param tag the tag.
+ * @return the field value, or null if not found.
+ * @throws ImagingException if an error occurs.
+ */
public String getFieldValue(final TagInfoXpString tag) throws ImagingException {
final TiffField field = findField(tag);
if (field == null) {
@@ -496,6 +719,12 @@ public class TiffImageMetadata extends GenericImageMetadata {
return tag.getValue(field);
}
+ /**
+ * Gets GPS information from metadata.
+ *
+ * @return the GPS info, or null if not available.
+ * @throws ImagingException if an error occurs.
+ */
public GpsInfo getGpsInfo() throws ImagingException {
final TiffDirectory gpsDirectory = findDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_GPS);
if (null == gpsDirectory) {
@@ -546,6 +775,12 @@ public class TiffImageMetadata extends GenericImageMetadata {
return result;
}
+ /**
+ * Gets an output set for writing.
+ *
+ * @return the output set.
+ * @throws ImagingException if an error occurs.
+ */
public TiffOutputSet getOutputSet() throws ImagingException {
final ByteOrder byteOrder = contents.header.byteOrder;
final TiffOutputSet result = new TiffOutputSet(byteOrder);
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
index 4c1740f3..aee69127 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
@@ -87,6 +87,15 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
return null;
}
+ /**
+ * Collects raw image data from all directories.
+ *
+ * @param byteSource the byte source.
+ * @param params the imaging parameters.
+ * @return the list of raw image data.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public List<byte[]> collectRawImageData(final ByteSource byteSource, final TiffImagingParameters params) throws ImagingException, IOException {
final FormatCompliance formatCompliance = FormatCompliance.getDefault();
final TiffContents contents = new TiffReader(params != null && params.isStrict()).readDirectories(byteSource, true, formatCompliance);
@@ -235,6 +244,16 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
return result;
}
+ /**
+ * Gets a buffered image from a TIFF directory.
+ *
+ * @param directory the TIFF directory.
+ * @param byteOrder the byte order.
+ * @param params the imaging parameters.
+ * @return the buffered image.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
protected BufferedImage getBufferedImage(final TiffDirectory directory, final ByteOrder byteOrder, final TiffImagingParameters params)
throws ImagingException, IOException {
final short compressionFieldValue;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
index c44ee48b..052e02e3 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
@@ -108,14 +108,29 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
subImageHeight = 0;
}
+ /**
+ * Gets the compression algorithm.
+ *
+ * @return the compression algorithm, or null if not set.
+ */
public Integer getCompression() {
return compression;
}
+ /**
+ * Gets the custom photometric interpreter.
+ *
+ * @return the custom photometric interpreter, or null if not set.
+ */
public AbstractPhotometricInterpreter getCustomPhotometricInterpreter() {
return customPhotometricInterpreter;
}
+ /**
+ * Gets the LZW compression block size.
+ *
+ * @return the LZW compression block size, or null if not set.
+ */
public Integer getLzwCompressionBlockSize() {
return lzwCompressionBlockSize;
}
@@ -165,14 +180,29 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
return subImageY;
}
+ /**
+ * Gets the T.4 options.
+ *
+ * @return the T.4 options, or null if not set.
+ */
public Integer getT4Options() {
return t4Options;
}
+ /**
+ * Gets the T.6 options.
+ *
+ * @return the T.6 options, or null if not set.
+ */
public Integer getT6Options() {
return t6Options;
}
+ /**
+ * Gets whether to read thumbnails.
+ *
+ * @return true if thumbnails should be read.
+ */
public boolean isReadThumbnails() {
return readThumbnails;
}
@@ -186,16 +216,34 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
return subImageWidth > 0 && subImageHeight > 0;
}
+ /**
+ * Sets the compression algorithm.
+ *
+ * @param compression the compression algorithm.
+ * @return this instance.
+ */
public TiffImagingParameters setCompression(final Integer compression) {
this.compression = compression;
return asThis();
}
+ /**
+ * Sets the custom photometric interpreter.
+ *
+ * @param customPhotometricInterpreter the custom photometric interpreter.
+ * @return this instance.
+ */
public TiffImagingParameters setCustomPhotometricInterpreter(final AbstractPhotometricInterpreter customPhotometricInterpreter) {
this.customPhotometricInterpreter = customPhotometricInterpreter;
return asThis();
}
+ /**
+ * Sets the LZW compression block size.
+ *
+ * @param lzwCompressionBlockSize the LZW compression block size.
+ * @return this instance.
+ */
public TiffImagingParameters setLzwCompressionBlockSize(final Integer lzwCompressionBlockSize) {
this.lzwCompressionBlockSize = lzwCompressionBlockSize;
return asThis();
@@ -213,6 +261,12 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
return asThis();
}
+ /**
+ * Sets whether to read thumbnails.
+ *
+ * @param readThumbnails true to read thumbnails.
+ * @return this instance.
+ */
public TiffImagingParameters setReadThumbnails(final boolean readThumbnails) {
this.readThumbnails = readThumbnails;
return asThis();
@@ -223,6 +277,7 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
* source images.
* <p>
* Note that the corner x and y coordinates must be positive integers (zero or greater). The width and height must be greater than zero.
+ * </p>
*
* @param x pixel coordinate of the upper-left corner of the source image, must be zero or greater.
* @param y pixel coordinate of the upper-left corner of the source image, must be zero or greater.
@@ -244,11 +299,23 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
return asThis();
}
+ /**
+ * Sets the T.4 options.
+ *
+ * @param t4Options the T.4 options.
+ * @return this instance.
+ */
public TiffImagingParameters setT4Options(final Integer t4Options) {
this.t4Options = t4Options;
return asThis();
}
+ /**
+ * Sets the T.6 options.
+ *
+ * @param t6Options the T.6 options.
+ * @return this instance.
+ */
public TiffImagingParameters setT6Options(final Integer t6Options) {
this.t6Options = t6Options;
return asThis();
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
index 562c1373..8cc8c574 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
@@ -41,6 +41,9 @@ import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoDirectory;
+/**
+ * TIFF file reader.
+ */
public class TiffReader extends BinaryFileParser {
private static class Collector implements Listener {
@@ -110,15 +113,47 @@ public class TiffReader extends BinaryFileParser {
}
}
+ /**
+ * Listener interface for TIFF reading callbacks.
+ */
public interface Listener {
+
+ /**
+ * Called when a directory is encountered.
+ *
+ * @param directory the directory.
+ * @return true to continue reading, false to stop.
+ */
boolean addDirectory(TiffDirectory directory);
+ /**
+ * Called when a field is encountered.
+ *
+ * @param field the field.
+ * @return true to continue reading, false to stop.
+ */
boolean addField(TiffField field);
+ /**
+ * Determines whether image data should be read.
+ *
+ * @return true to read image data, false otherwise.
+ */
boolean readImageData();
+ /**
+ * Determines whether offset directories should be read.
+ *
+ * @return true to read offset directories, false otherwise.
+ */
boolean readOffsetDirectories();
+ /**
+ * Called when the TIFF header is read.
+ *
+ * @param tiffHeader the TIFF header.
+ * @return true to continue reading, false to stop.
+ */
boolean setTiffHeader(TiffHeader tiffHeader);
}
@@ -127,6 +162,11 @@ public class TiffReader extends BinaryFileParser {
private boolean standardTiff;
private int entryMaxValueLength;
+ /**
+ * Constructs a new instance.
+ *
+ * @param strict true for strict parsing, false otherwise.
+ */
public TiffReader(final boolean strict) {
this.strict = strict;
}
@@ -207,10 +247,29 @@ public class TiffReader extends BinaryFileParser {
return new AbstractTiffImageData.Tiles(data, tileWidth, tileLength);
}
+ /**
+ * Reads TIFF data from the byte source.
+ *
+ * @param byteSource the byte source.
+ * @param formatCompliance the format compliance.
+ * @param listener the listener for callbacks.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public void read(final ByteSource byteSource, final FormatCompliance formatCompliance, final Listener listener) throws ImagingException, IOException {
readDirectories(byteSource, formatCompliance, listener);
}
+ /**
+ * Reads the contents of a TIFF file.
+ *
+ * @param byteSource the byte source.
+ * @param params the imaging parameters.
+ * @param formatCompliance the format compliance.
+ * @return the TIFF contents.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public TiffContents readContents(final ByteSource byteSource, final TiffImagingParameters params, final FormatCompliance formatCompliance)
throws ImagingException, IOException {
@@ -219,6 +278,16 @@ public class TiffReader extends BinaryFileParser {
return collector.getContents();
}
+ /**
+ * Reads all directories from a TIFF file.
+ *
+ * @param byteSource the byte source.
+ * @param readImageData true to read image data, false otherwise.
+ * @param formatCompliance the format compliance.
+ * @return the TIFF contents.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public TiffContents readDirectories(final ByteSource byteSource, final boolean readImageData, final FormatCompliance formatCompliance)
throws ImagingException, IOException {
final TiffImagingParameters params = new TiffImagingParameters();
@@ -418,6 +487,16 @@ public class TiffReader extends BinaryFileParser {
return readDirectory(byteSource, offset, dirType, formatCompliance, listener, ignoreNextDirectory, visited);
}
+ /**
+ * Reads only the first directory from a TIFF file.
+ *
+ * @param byteSource the byte source.
+ * @param readImageData true to read image data, false otherwise.
+ * @param formatCompliance the format compliance.
+ * @return the TIFF contents containing only the first directory.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public TiffContents readFirstDirectory(final ByteSource byteSource, final boolean readImageData, final FormatCompliance formatCompliance)
throws ImagingException, IOException {
final Collector collector = new FirstDirectoryCollector(readImageData);
(commons-imaging) 07/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit e226bdb2549a455b1ffe02e11e323321f4084ab1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:15 2026 -0500
Javadoc
---
.../imaging/formats/psd/datareaders/UncompressedDataReader.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
index 8edc2ee2..78d46295 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
@@ -30,10 +30,18 @@ import org.apache.commons.imaging.formats.psd.dataparsers.AbstractDataParser;
import org.apache.commons.imaging.mylzw.BitsToByteInputStream;
import org.apache.commons.imaging.mylzw.MyBitInputStream;
+/**
+ * Data reader for uncompressed PSD image data.
+ */
public class UncompressedDataReader implements DataReader {
private final AbstractDataParser dataParser;
+ /**
+ * Constructs a new uncompressed data reader.
+ *
+ * @param dataParser the data parser.
+ */
public UncompressedDataReader(final AbstractDataParser dataParser) {
this.dataParser = dataParser;
}
(commons-imaging) 01/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit fe0cbd5b37ec96deb11a77c0a1665a2a64706b2d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 06:54:17 2026 -0500
Javadoc
---
.../imaging/formats/jpeg/JpegImageMetadata.java | 44 +++++-
.../imaging/formats/jpeg/JpegImageParser.java | 26 ++++
.../commons/imaging/formats/jpeg/JpegUtils.java | 55 +++++++-
.../imaging/formats/jpeg/xmp/JpegRewriter.java | 156 ++++++++++++++++++++-
.../imaging/formats/psd/PsdImageContents.java | 28 ++++
.../formats/tiff/taginfos/TagInfoLongOrIfd.java | 7 +
.../formats/tiff/taginfos/TagInfoSRationals.java | 26 ++++
.../formats/tiff/taginfos/TagInfoSShort.java | 25 ++++
.../formats/tiff/taginfos/TagInfoSShorts.java | 26 ++++
.../formats/tiff/taginfos/TagInfoUndefined.java | 11 ++
.../formats/tiff/taginfos/TagInfoUndefineds.java | 12 ++
.../formats/tiff/taginfos/TagInfoUnknown.java | 8 ++
.../formats/tiff/taginfos/TagInfoUnknowns.java | 12 ++
.../formats/tiff/taginfos/TagInfoXpString.java | 8 ++
.../commons/imaging/icc/IccProfileParser.java | 45 ++++++
.../commons/imaging/mylzw/MyLzwCompressor.java | 61 ++++++++
16 files changed, 542 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
index 77d843c4..454b5fd4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
@@ -35,20 +35,39 @@ import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
import org.apache.commons.imaging.internal.Debug;
+/**
+ * JPEG image metadata.
+ */
public class JpegImageMetadata implements ImageMetadata {
+
private static final String NEWLINE = System.lineSeparator();
private final JpegPhotoshopMetadata photoshop;
private final TiffImageMetadata exif;
+ /**
+ * Constructs a new instance.
+ *
+ * @param photoshop the Photoshop metadata.
+ * @param exif the EXIF metadata.
+ */
public JpegImageMetadata(final JpegPhotoshopMetadata photoshop, final TiffImageMetadata exif) {
this.photoshop = photoshop;
this.exif = exif;
}
+ /**
+ * Dumps metadata to debug output.
+ */
public void dump() {
Debug.debug(this.toString());
}
+ /**
+ * Finds an EXIF value.
+ *
+ * @param tagInfo the tag info.
+ * @return the TIFF field or null if not found.
+ */
public TiffField findExifValue(final TagInfo tagInfo) {
try {
return exif != null ? exif.findField(tagInfo) : null;
@@ -57,6 +76,12 @@ public class JpegImageMetadata implements ImageMetadata {
}
}
+ /**
+ * Finds an EXIF value with exact match.
+ *
+ * @param tagInfo the tag info.
+ * @return the TIFF field or null if not found.
+ */
public TiffField findExifValueWithExactMatch(final TagInfo tagInfo) {
try {
return exif != null ? exif.findField(tagInfo, true) : null;
@@ -65,6 +90,11 @@ public class JpegImageMetadata implements ImageMetadata {
}
}
+ /**
+ * Gets the EXIF metadata.
+ *
+ * @return the EXIF metadata.
+ */
public TiffImageMetadata getExif() {
return exif;
}
@@ -73,8 +103,8 @@ public class JpegImageMetadata implements ImageMetadata {
* Gets the thumbnail image if available.
*
* @return the thumbnail image. May be {@code null} if no image could be found.
- * @throws ImagingException if it fails to read the image
- * @throws IOException if it fails to get the thumbnail or to read the image data
+ * @throws ImagingException if it fails to read the image.
+ * @throws IOException if it fails to get the thumbnail or to read the image data.
*/
public BufferedImage getExifThumbnail() throws ImagingException, IOException {
@@ -174,10 +204,20 @@ public class JpegImageMetadata implements ImageMetadata {
return result;
}
+ /**
+ * Gets the Photoshop metadata.
+ *
+ * @return the Photoshop metadata.
+ */
public JpegPhotoshopMetadata getPhotoshop() {
return photoshop;
}
+ /**
+ * Gets the raw image data.
+ *
+ * @return the raw image data or null if not found.
+ */
public AbstractTiffImageData getRawImageData() {
if (exif == null) {
return null;
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
index 20fe5b1a..fa6bc1a0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
@@ -63,6 +63,9 @@ import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
import org.apache.commons.imaging.internal.Debug;
import org.apache.commons.lang3.ArrayUtils;
+/**
+ * JPEG image parser.
+ */
public class JpegImageParser extends AbstractImageParser<JpegImagingParameters> implements XmpEmbeddable<JpegImagingParameters> {
private static final Logger LOGGER = Logger.getLogger(JpegImageParser.class.getName());
@@ -70,6 +73,12 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
private static final String DEFAULT_EXTENSION = ImageFormats.JPEG.getDefaultExtension();
private static final String[] ACCEPTED_EXTENSIONS = ImageFormats.JPEG.getExtensions();
+ /**
+ * Checks if the segment is an EXIF APP1 segment.
+ *
+ * @param segment the segment.
+ * @return true if EXIF APP1 segment, false otherwise.
+ */
public static boolean isExifApp1Segment(final AbstractGenericSegment segment) {
return JpegConstants.EXIF_IDENTIFIER_CODE.isStartOf(segment.getSegmentData());
}
@@ -226,6 +235,15 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
return new JpegImagingParameters();
}
+ /**
+ * Gets EXIF metadata.
+ *
+ * @param byteSource the byte source.
+ * @param params the TIFF imaging parameters.
+ * @return the EXIF metadata or null if not found.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public TiffImageMetadata getExifMetadata(final ByteSource byteSource, TiffImagingParameters params) throws ImagingException, IOException {
final byte[] bytes = getExifRawData(byteSource);
if (null == bytes) {
@@ -240,6 +258,14 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
return (TiffImageMetadata) new TiffImageParser().getMetadata(bytes, params);
}
+ /**
+ * Gets raw EXIF data.
+ *
+ * @param byteSource the byte source.
+ * @return the raw EXIF data or null if not found.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public byte[] getExifRawData(final ByteSource byteSource) throws ImagingException, IOException {
final List<AbstractSegment> abstractSegments = readSegments(byteSource, new int[] { JpegConstants.JPEG_APP1_MARKER, }, false);
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
index 51f93b34..5b56aa2b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
@@ -27,18 +27,54 @@ import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.internal.Debug;
import org.apache.commons.io.IOUtils;
+/**
+ * JPEG utility methods.
+ */
public class JpegUtils extends BinaryFileParser {
+
+ /**
+ * Visitor interface for traversing JPEG segments.
+ */
public interface Visitor {
- // return false to exit before reading image data.
+
+ /**
+ * Called when beginning SOS (Start of Scan) segment.
+ *
+ * @return false to exit before reading image data.
+ */
boolean beginSos();
- // return false to exit traversal.
+ /**
+ * Called when visiting a segment.
+ *
+ * @param marker the marker.
+ * @param markerBytes the marker bytes.
+ * @param segmentLength the segment length.
+ * @param segmentLengthBytes the segment length bytes.
+ * @param segmentData the segment data.
+ * @return false to exit traversal.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
boolean visitSegment(int marker, byte[] markerBytes, int segmentLength, byte[] segmentLengthBytes, byte[] segmentData)
throws ImagingException, IOException;
+ /**
+ * Called when visiting SOS segment.
+ *
+ * @param marker the marker.
+ * @param markerBytes the marker bytes.
+ * @param imageData the image data.
+ */
void visitSos(int marker, byte[] markerBytes, byte[] imageData);
}
+ /**
+ * Gets the marker name.
+ *
+ * @param marker the marker.
+ * @return the marker name.
+ */
public static String getMarkerName(final int marker) {
switch (marker) {
case JpegConstants.SOS_MARKER:
@@ -123,6 +159,13 @@ public class JpegUtils extends BinaryFileParser {
// empty
}
+ /**
+ * Dumps JFIF data.
+ *
+ * @param byteSource the byte source.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public void dumpJfif(final ByteSource byteSource) throws ImagingException, IOException {
final Visitor visitor = new Visitor() {
// return false to exit before reading image data.
@@ -150,6 +193,14 @@ public class JpegUtils extends BinaryFileParser {
traverseJfif(byteSource, visitor);
}
+ /**
+ * Traverses JFIF data with a visitor.
+ *
+ * @param byteSource the byte source.
+ * @param visitor the visitor.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public void traverseJfif(final ByteSource byteSource, final Visitor visitor) throws ImagingException, IOException {
try (InputStream is = byteSource.getInputStream()) {
BinaryFunctions.readAndVerifyBytes(is, JpegConstants.SOI, "Not a Valid JPEG File: doesn't begin with 0xffd8");
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
index 09bf6711..d69f34c9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
@@ -41,13 +41,28 @@ public class JpegRewriter extends BinaryFileParser {
return "[" + this.getClass().getName() + "]";
}
+ /**
+ * Writes the piece to output stream.
+ *
+ * @param os the output stream.
+ * @throws IOException if an I/O error occurs.
+ */
protected abstract void write(OutputStream os) throws IOException;
}
+ /**
+ * JFIF piece representing image data.
+ */
static class JFIFPieceImageData extends JFIFPiece {
private final byte[] markerBytes;
private final byte[] imageData;
+ /**
+ * Constructs image data piece.
+ *
+ * @param markerBytes the marker bytes.
+ * @param imageData the image data.
+ */
JFIFPieceImageData(final byte[] markerBytes, final byte[] imageData) {
this.markerBytes = markerBytes;
this.imageData = imageData;
@@ -60,10 +75,23 @@ public class JpegRewriter extends BinaryFileParser {
}
}
+ /**
+ * JFIF pieces collection.
+ */
protected static class JFIFPieces {
+
+ /** All pieces. */
public final List<JFIFPiece> pieces;
+
+ /** Segment pieces only. */
public final List<JFIFPiece> segmentPieces;
+ /**
+ * Constructs JFIF pieces.
+ *
+ * @param pieces all pieces.
+ * @param segmentPieces segment pieces.
+ */
public JFIFPieces(final List<JFIFPiece> pieces, final List<JFIFPiece> segmentPieces) {
this.pieces = pieces;
this.segmentPieces = segmentPieces;
@@ -71,17 +99,37 @@ public class JpegRewriter extends BinaryFileParser {
}
+ /**
+ * JFIF piece representing a segment.
+ */
protected static class JFIFPieceSegment extends JFIFPiece {
+
+ /** Marker value. */
public final int marker;
+
private final byte[] markerBytes;
private final byte[] segmentLengthBytes;
private final byte[] segmentData;
+ /**
+ * Constructs a segment piece.
+ *
+ * @param marker the marker.
+ * @param segmentData the segment data.
+ */
public JFIFPieceSegment(final int marker, final byte[] segmentData) {
this(marker, ByteConversions.toBytes((short) marker, JPEG_BYTE_ORDER), ByteConversions.toBytes((short) (segmentData.length + 2), JPEG_BYTE_ORDER),
segmentData);
}
+ /**
+ * Constructs a segment piece.
+ *
+ * @param marker the marker.
+ * @param markerBytes the marker bytes.
+ * @param segmentLengthBytes the segment length bytes.
+ * @param segmentData the segment data.
+ */
JFIFPieceSegment(final int marker, final byte[] markerBytes, final byte[] segmentLengthBytes, final byte[] segmentData) {
this.marker = marker;
this.markerBytes = markerBytes;
@@ -89,18 +137,38 @@ public class JpegRewriter extends BinaryFileParser {
this.segmentData = segmentData.clone();
}
+ /**
+ * Gets the segment data.
+ *
+ * @return the segment data.
+ */
public byte[] getSegmentData() {
return segmentData.clone();
}
+ /**
+ * Checks if this is an APP1 segment.
+ *
+ * @return true if APP1 segment, false otherwise.
+ */
public boolean isApp1Segment() {
return marker == JpegConstants.JPEG_APP1_MARKER;
}
+ /**
+ * Checks if this is an APP segment.
+ *
+ * @return true if APP segment, false otherwise.
+ */
public boolean isAppSegment() {
return marker >= JpegConstants.JPEG_APP0_MARKER && marker <= JpegConstants.JPEG_APP15_MARKER;
}
+ /**
+ * Checks if this is an EXIF segment.
+ *
+ * @return true if EXIF segment, false otherwise.
+ */
public boolean isExifSegment() {
if (marker != JpegConstants.JPEG_APP1_MARKER) {
return false;
@@ -111,6 +179,11 @@ public class JpegRewriter extends BinaryFileParser {
return true;
}
+ /**
+ * Checks if this is a Photoshop APP13 segment.
+ *
+ * @return true if Photoshop APP13 segment, false otherwise.
+ */
public boolean isPhotoshopApp13Segment() {
if (marker != JpegConstants.JPEG_APP13_MARKER) {
return false;
@@ -121,6 +194,11 @@ public class JpegRewriter extends BinaryFileParser {
return true;
}
+ /**
+ * Checks if this is an XMP segment.
+ *
+ * @return true if XMP segment, false otherwise.
+ */
public boolean isXmpSegment() {
if (marker != JpegConstants.JPEG_APP1_MARKER) {
return false;
@@ -145,7 +223,17 @@ public class JpegRewriter extends BinaryFileParser {
}
+ /**
+ * Segment filter interface.
+ */
private interface SegmentFilter {
+
+ /**
+ * Filters a segment.
+ *
+ * @param segment the segment.
+ * @return true to include, false to exclude.
+ */
boolean filter(JFIFPieceSegment segment);
}
@@ -158,15 +246,20 @@ public class JpegRewriter extends BinaryFileParser {
private static final SegmentFilter PHOTOSHOP_APP13_SEGMENT_FILTER = JFIFPieceSegment::isPhotoshopApp13Segment;
/**
- * Constructs a new instance with the default, big-endian, byte order.
- * <p>
- * Whether a file contains an image based on its file extension.
- * </p>
+ * Constructs a new instance.
*/
public JpegRewriter() {
// empty
}
+ /**
+ * Analyzes JFIF structure.
+ *
+ * @param byteSource the byte source.
+ * @return the JFIF pieces.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
protected JFIFPieces analyzeJfif(final ByteSource byteSource) throws ImagingException, IOException {
final List<JFIFPiece> pieces = new ArrayList<>();
final List<JFIFPiece> segmentPieces = new ArrayList<>();
@@ -220,10 +313,27 @@ public class JpegRewriter extends BinaryFileParser {
return result;
}
+ /**
+ * Finds Photoshop APP13 segments.
+ *
+ * @param <T> the piece type.
+ * @param segments the segments.
+ * @return the filtered segments.
+ */
protected <T extends JFIFPiece> List<T> findPhotoshopApp13Segments(final List<T> segments) {
return filterSegments(segments, PHOTOSHOP_APP13_SEGMENT_FILTER, true);
}
+ /**
+ * Inserts new segments after last APP segment.
+ *
+ * @param <T> the piece type.
+ * @param <U> the new piece type.
+ * @param segments the segments.
+ * @param newSegments the new segments to insert.
+ * @return the combined segments.
+ * @throws ImagingException if an imaging error occurs.
+ */
protected <T extends JFIFPiece, U extends JFIFPiece> List<JFIFPiece> insertAfterLastAppSegments(final List<T> segments, final List<U> newSegments)
throws ImagingException {
int lastAppIndex = -1;
@@ -252,6 +362,16 @@ public class JpegRewriter extends BinaryFileParser {
return result;
}
+ /**
+ * Inserts new segments before first APP segment.
+ *
+ * @param <T> the piece type.
+ * @param <U> the new piece type.
+ * @param segments the segments.
+ * @param newSegments the new segments to insert.
+ * @return the combined segments.
+ * @throws ImagingException if an imaging error occurs.
+ */
protected <T extends JFIFPiece, U extends JFIFPiece> List<JFIFPiece> insertBeforeFirstAppSegments(final List<T> segments, final List<U> newSegments)
throws ImagingException {
int firstAppIndex = -1;
@@ -275,14 +395,35 @@ public class JpegRewriter extends BinaryFileParser {
return result;
}
+ /**
+ * Removes EXIF segments.
+ *
+ * @param <T> the piece type.
+ * @param segments the segments.
+ * @return the filtered segments.
+ */
protected <T extends JFIFPiece> List<T> removeExifSegments(final List<T> segments) {
return filterSegments(segments, EXIF_SEGMENT_FILTER);
}
+ /**
+ * Removes Photoshop APP13 segments.
+ *
+ * @param <T> the piece type.
+ * @param segments the segments.
+ * @return the filtered segments.
+ */
protected <T extends JFIFPiece> List<T> removePhotoshopApp13Segments(final List<T> segments) {
return filterSegments(segments, PHOTOSHOP_APP13_SEGMENT_FILTER);
}
+ /**
+ * Removes XMP segments.
+ *
+ * @param <T> the piece type.
+ * @param segments the segments.
+ * @return the filtered segments.
+ */
protected <T extends JFIFPiece> List<T> removeXmpSegments(final List<T> segments) {
return filterSegments(segments, XMP_SEGMENT_FILTER);
}
@@ -304,6 +445,13 @@ public class JpegRewriter extends BinaryFileParser {
// os.write(piece.segmentData);
// }
+ /**
+ * Writes segments to output stream.
+ *
+ * @param outputStream the output stream.
+ * @param segments the segments to write.
+ * @throws IOException if an I/O error occurs.
+ */
protected void writeSegments(final OutputStream outputStream, final List<? extends JFIFPiece> segments) throws IOException {
try (DataOutputStream os = new DataOutputStream(outputStream)) {
JpegConstants.SOI.writeTo(os);
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java
index 4081b08d..e6f37d9c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java
@@ -22,17 +22,37 @@ import java.io.StringWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
+/**
+ * PSD image contents.
+ */
public class PsdImageContents {
private static final Logger LOGGER = Logger.getLogger(PsdImageContents.class.getName());
+ /** PSD header information. */
public final PsdHeaderInfo header;
+ /** Color mode data length. */
public final int colorModeDataLength;
+
+ /** Image resources length. */
public final int imageResourcesLength;
+
+ /** Layer and mask data length. */
public final int layerAndMaskDataLength;
+
+ /** Compression type. */
public final int compression;
+ /**
+ * Constructs PSD image contents.
+ *
+ * @param header the header information.
+ * @param colorModeDataLength the color mode data length.
+ * @param imageResourcesLength the image resources length.
+ * @param layerAndMaskDataLength the layer and mask data length.
+ * @param compression the compression type.
+ */
public PsdImageContents(final PsdHeaderInfo header,
final int colorModeDataLength, final int imageResourcesLength, final int layerAndMaskDataLength, final int compression) {
@@ -43,6 +63,9 @@ public class PsdImageContents {
this.compression = compression;
}
+ /**
+ * Dumps contents to logger.
+ */
public void dump() {
try (StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw)) {
@@ -55,6 +78,11 @@ public class PsdImageContents {
}
}
+ /**
+ * Dumps contents to print writer.
+ *
+ * @param pw the print writer.
+ */
public void dump(final PrintWriter pw) {
pw.println("");
pw.println("ImageContents");
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongOrIfd.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongOrIfd.java
index 6557f79b..7c9cc110 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongOrIfd.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongOrIfd.java
@@ -63,6 +63,13 @@ public class TagInfoLongOrIfd extends TagInfo {
return ByteConversions.toBytes(values, byteOrder);
}
+ /**
+ * Gets the values.
+ *
+ * @param byteOrder the byte order.
+ * @param bytes the bytes.
+ * @return the integer array values.
+ */
public int[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
return ByteConversions.toInts(bytes, byteOrder);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java
index be57e007..81889f46 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java
@@ -23,15 +23,41 @@ import org.apache.commons.imaging.common.RationalNumber;
import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
+/**
+ * Tag info for signed rationals (array) field type.
+ */
public class TagInfoSRationals extends TagInfo {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param name the tag name.
+ * @param tag the tag number.
+ * @param length the length.
+ * @param directoryType the directory type.
+ */
public TagInfoSRationals(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
super(name, tag, AbstractFieldType.SRATIONAL, length, directoryType);
}
+ /**
+ * Encodes values.
+ *
+ * @param byteOrder the byte order.
+ * @param values the values.
+ * @return the encoded bytes.
+ */
public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber... values) {
return ByteConversions.toBytes(values, byteOrder);
}
+ /**
+ * Gets the values.
+ *
+ * @param byteOrder the byte order.
+ * @param bytes the bytes.
+ * @return the rational number array values.
+ */
public RationalNumber[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
return ByteConversions.toRationals(bytes, byteOrder, false);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java
index cb5f1fc3..2ae2b29c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java
@@ -22,15 +22,40 @@ import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
+/**
+ * Tag info for signed short field type.
+ */
public class TagInfoSShort extends TagInfo {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param name the tag name.
+ * @param tag the tag number.
+ * @param directoryType the directory type.
+ */
public TagInfoSShort(final String name, final int tag, final TiffDirectoryType directoryType) {
super(name, tag, AbstractFieldType.SSHORT, 1, directoryType);
}
+ /**
+ * Encodes a value.
+ *
+ * @param byteOrder the byte order.
+ * @param value the value.
+ * @return the encoded bytes.
+ */
public byte[] encodeValue(final ByteOrder byteOrder, final short value) {
return ByteConversions.toBytes(value, byteOrder);
}
+ /**
+ * Gets the value.
+ *
+ * @param byteOrder the byte order.
+ * @param bytes the bytes.
+ * @return the short value.
+ */
public short getValue(final ByteOrder byteOrder, final byte[] bytes) {
return ByteConversions.toShort(bytes, byteOrder);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java
index e5f51e8b..ac8f7e23 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java
@@ -22,15 +22,41 @@ import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
+/**
+ * Tag info for signed shorts (array) field type.
+ */
public class TagInfoSShorts extends TagInfo {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param name the tag name.
+ * @param tag the tag number.
+ * @param length the length.
+ * @param directoryType the directory type.
+ */
public TagInfoSShorts(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
super(name, tag, AbstractFieldType.SSHORT, length, directoryType);
}
+ /**
+ * Encodes values.
+ *
+ * @param byteOrder the byte order.
+ * @param values the values.
+ * @return the encoded bytes.
+ */
public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
return ByteConversions.toBytes(values, byteOrder);
}
+ /**
+ * Gets the values.
+ *
+ * @param byteOrder the byte order.
+ * @param bytes the bytes.
+ * @return the short array values.
+ */
public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
return ByteConversions.toShorts(bytes, byteOrder);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java
index 27daf610..9348458a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java
@@ -19,7 +19,18 @@ package org.apache.commons.imaging.formats.tiff.taginfos;
import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
+/**
+ * Tag info for undefined field type.
+ */
public class TagInfoUndefined extends TagInfoByte {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param name the tag name.
+ * @param tag the tag number.
+ * @param directoryType the directory type.
+ */
public TagInfoUndefined(final String name, final int tag, final TiffDirectoryType directoryType) {
super(name, tag, AbstractFieldType.UNDEFINED, directoryType);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java
index 6bbaf7f6..e08b86d9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java
@@ -19,7 +19,19 @@ package org.apache.commons.imaging.formats.tiff.taginfos;
import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
+/**
+ * Tag info for undefineds (array) field type.
+ */
public class TagInfoUndefineds extends TagInfoBytes {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param name the tag name.
+ * @param tag the tag number.
+ * @param length the length.
+ * @param directoryType the directory type.
+ */
public TagInfoUndefineds(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
super(name, tag, AbstractFieldType.UNDEFINED, length, directoryType);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java
index 491cb162..042605ae 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java
@@ -23,6 +23,14 @@ import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
* A TIFF tag whose definition isn't known.
*/
public final class TagInfoUnknown extends TagInfoByte {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param name the tag name.
+ * @param tag the tag number.
+ * @param exifDirectory the EXIF directory.
+ */
public TagInfoUnknown(final String name, final int tag, final TiffDirectoryType exifDirectory) {
super(name, tag, AbstractFieldType.ANY, exifDirectory);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java
index 45013e8d..5cddd37d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java
@@ -19,7 +19,19 @@ package org.apache.commons.imaging.formats.tiff.taginfos;
import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
+/**
+ * Tag info for unknowns (array) field type.
+ */
public class TagInfoUnknowns extends TagInfoBytes {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param name the tag name.
+ * @param tag the tag number.
+ * @param length the length.
+ * @param exifDirectory the EXIF directory.
+ */
public TagInfoUnknowns(final String name, final int tag, final int length, final TiffDirectoryType exifDirectory) {
super(name, tag, AbstractFieldType.ANY, length, exifDirectory);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java
index b782be6d..b2425cb2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java
@@ -29,6 +29,14 @@ import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
* Windows XP onwards store some tags using UTF-16LE, but the field type is byte - here we deal with this.
*/
public class TagInfoXpString extends TagInfo {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param name the tag name.
+ * @param tag the tag number.
+ * @param directoryType the directory type.
+ */
public TagInfoXpString(final String name, final int tag, final TiffDirectoryType directoryType) {
super(name, tag, AbstractFieldType.BYTE, LENGTH_UNKNOWN, directoryType);
}
diff --git a/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java b/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
index e66eac67..35d91d85 100644
--- a/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
+++ b/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
@@ -33,6 +33,9 @@ import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.BinaryFileParser;
import org.apache.commons.io.IOUtils;
+/**
+ * ICC profile parser.
+ */
public class IccProfileParser extends BinaryFileParser {
private static final Logger LOGGER = Logger.getLogger(IccProfileParser.class.getName());
@@ -44,6 +47,13 @@ public class IccProfileParser extends BinaryFileParser {
// empty
}
+ /**
+ * Gets ICC profile info from bytes.
+ *
+ * @param bytes the bytes.
+ * @return the ICC profile info or null if bytes is null.
+ * @throws IOException if an I/O error occurs.
+ */
public IccProfileInfo getIccProfileInfo(final byte[] bytes) throws IOException {
if (bytes == null) {
return null;
@@ -51,6 +61,13 @@ public class IccProfileParser extends BinaryFileParser {
return getIccProfileInfo(ByteSource.array(bytes));
}
+ /**
+ * Gets ICC profile info from byte source.
+ *
+ * @param byteSource the byte source.
+ * @return the ICC profile info.
+ * @throws IOException if an I/O error occurs.
+ */
public IccProfileInfo getIccProfileInfo(final ByteSource byteSource) throws IOException {
// TODO Throw instead of logging?
final IccProfileInfo result;
@@ -68,6 +85,13 @@ public class IccProfileParser extends BinaryFileParser {
return result;
}
+ /**
+ * Gets ICC profile info from file.
+ *
+ * @param file the file.
+ * @return the ICC profile info or null if file is null.
+ * @throws IOException if an I/O error occurs.
+ */
public IccProfileInfo getIccProfileInfo(final File file) throws IOException {
if (file == null) {
return null;
@@ -76,6 +100,13 @@ public class IccProfileParser extends BinaryFileParser {
return getIccProfileInfo(ByteSource.file(file));
}
+ /**
+ * Gets ICC profile info from ICC_Profile.
+ *
+ * @param iccProfile the ICC profile.
+ * @return the ICC profile info or null if iccProfile is null.
+ * @throws IOException if an I/O error occurs.
+ */
public IccProfileInfo getIccProfileInfo(final ICC_Profile iccProfile) throws IOException {
if (iccProfile == null) {
return null;
@@ -94,10 +125,24 @@ public class IccProfileParser extends BinaryFileParser {
return null;
}
+ /**
+ * Checks if the profile is sRGB.
+ *
+ * @param bytes the bytes.
+ * @return true if sRGB, false otherwise.
+ * @throws IOException if an I/O error occurs.
+ */
public boolean isSrgb(final byte[] bytes) throws IOException {
return isSrgb(ByteSource.array(bytes));
}
+ /**
+ * Checks if the profile is sRGB.
+ *
+ * @param byteSource the byte source.
+ * @return true if sRGB, false otherwise.
+ * @throws IOException if an I/O error occurs.
+ */
public boolean isSrgb(final ByteSource byteSource) throws IOException {
// setDebug(true);
diff --git a/src/main/java/org/apache/commons/imaging/mylzw/MyLzwCompressor.java b/src/main/java/org/apache/commons/imaging/mylzw/MyLzwCompressor.java
index 4439ef41..30aa9320 100644
--- a/src/main/java/org/apache/commons/imaging/mylzw/MyLzwCompressor.java
+++ b/src/main/java/org/apache/commons/imaging/mylzw/MyLzwCompressor.java
@@ -25,13 +25,27 @@ import java.util.Map;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.Allocator;
+/**
+ * LZW compressor implementation.
+ */
public class MyLzwCompressor {
+
+ /**
+ * Byte array wrapper for hash map keys.
+ */
private static final class ByteArray {
private final byte[] bytes;
private final int start;
private final int length;
private final int hash;
+ /**
+ * Constructs a byte array wrapper.
+ *
+ * @param bytes the bytes.
+ * @param start the start index.
+ * @param length the length.
+ */
ByteArray(final byte[] bytes, final int start, final int length) {
this.bytes = bytes;
this.start = start;
@@ -75,13 +89,38 @@ public class MyLzwCompressor {
}
}
+ /**
+ * Listener interface for LZW compression events.
+ */
public interface Listener {
+
+ /**
+ * Called for clear code.
+ *
+ * @param code the code.
+ */
void clearCode(int code);
+ /**
+ * Called for data code.
+ *
+ * @param code the code.
+ */
void dataCode(int code);
+ /**
+ * Called for end of information code.
+ *
+ * @param code the code.
+ */
void eoiCode(int code);
+ /**
+ * Initializes the listener.
+ *
+ * @param clearCode the clear code.
+ * @param eoiCode the end of information code.
+ */
void init(int clearCode, int eoiCode);
}
@@ -98,10 +137,25 @@ public class MyLzwCompressor {
private final Map<ByteArray, Integer> map = new HashMap<>();
+ /**
+ * Constructs a new instance.
+ *
+ * @param initialCodeSize the initial code size.
+ * @param byteOrder the byte order.
+ * @param earlyLimit whether to use early limit.
+ */
public MyLzwCompressor(final int initialCodeSize, final ByteOrder byteOrder, final boolean earlyLimit) {
this(initialCodeSize, byteOrder, earlyLimit, null);
}
+ /**
+ * Constructs a new instance.
+ *
+ * @param initialCodeSize the initial code size.
+ * @param byteOrder the byte order.
+ * @param earlyLimit whether to use early limit.
+ * @param listener the listener.
+ */
public MyLzwCompressor(final int initialCodeSize, final ByteOrder byteOrder, final boolean earlyLimit, final Listener listener) {
this.listener = listener;
this.byteOrder = byteOrder;
@@ -172,6 +226,13 @@ public class MyLzwCompressor {
return code;
}
+ /**
+ * Compresses data using LZW compression.
+ *
+ * @param bytes the bytes to compress.
+ * @return the compressed bytes.
+ * @throws IOException if an I/O error occurs.
+ */
public byte[] compress(final byte[] bytes) throws IOException {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream(Allocator.checkByteArray(bytes.length));
MyBitOutputStream bos = new MyBitOutputStream(baos, byteOrder)) {
(commons-imaging) 11/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 1ffafd68e83fa9af05c22a59c5a674191af9065d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:39 2026 -0500
Javadoc
---
.../org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
index 325fd60c..7ff77f16 100644
--- a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
@@ -39,8 +39,14 @@ import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.bytesource.ByteSource;
import org.apache.commons.imaging.common.ImageMetadata;
+/**
+ * Parser for Wireless Bitmap (WBMP) images.
+ */
public class WbmpImageParser extends AbstractImageParser<WbmpImagingParameters> {
+ /**
+ * WBMP header structure.
+ */
static class WbmpHeader {
final int typeField;
final byte fixHeaderField;
(commons-imaging) 16/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit cecdcc8dd05235d96a0c4cc6caf31584def64498
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:42:48 2026 -0500
Javadoc
---
.../imaging/common/XmpImagingParameters.java | 7 ++++
.../imaging/formats/bmp/BmpImageParser.java | 2 +-
.../imaging/formats/dcx/DcxImageParser.java | 2 +-
.../imaging/formats/icns/IcnsImageParser.java | 2 +-
.../imaging/formats/ico/IcoImageParser.java | 2 +-
.../imaging/formats/jpeg/iptc/IptcParser.java | 2 +-
.../imaging/formats/jpeg/xmp/JpegRewriter.java | 8 ++++
.../imaging/formats/pnm/PnmImageParser.java | 2 +-
.../formats/psd/dataparsers/DataParserBitmap.java | 2 +-
.../formats/psd/dataparsers/DataParserCmyk.java | 2 +-
.../psd/dataparsers/DataParserGrayscale.java | 2 +-
.../formats/psd/dataparsers/DataParserIndexed.java | 2 +-
.../formats/psd/dataparsers/DataParserLab.java | 2 +-
.../formats/psd/dataparsers/DataParserRgb.java | 2 +-
.../imaging/formats/rgbe/RgbeImageParser.java | 2 +-
.../formats/tiff/TiffImagingParameters.java | 7 ++++
.../tiff/constants/TiffDirectoryConstants.java | 34 ++++++++++++++++
.../formats/tiff/constants/TiffDirectoryType.java | 43 ++++++++++++++++++++
.../formats/tiff/constants/TiffEpTagConstants.java | 46 ++++++++++++++++++++++
.../imaging/formats/wbmp/WbmpImageParser.java | 2 +-
.../formats/wbmp/WbmpImagingParameters.java | 8 +++-
.../formats/webp/WebPImagingParameters.java | 7 ++++
.../imaging/formats/xbm/XbmImageParser.java | 2 +-
.../imaging/formats/xbm/XbmImagingParameters.java | 8 +++-
.../imaging/formats/xpm/XpmImageParser.java | 2 +-
.../imaging/formats/xpm/XpmImagingParameters.java | 8 +++-
26 files changed, 189 insertions(+), 19 deletions(-)
diff --git a/src/main/java/org/apache/commons/imaging/common/XmpImagingParameters.java b/src/main/java/org/apache/commons/imaging/common/XmpImagingParameters.java
index a8b393c4..cbd1805f 100644
--- a/src/main/java/org/apache/commons/imaging/common/XmpImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/common/XmpImagingParameters.java
@@ -27,6 +27,13 @@ import org.apache.commons.imaging.ImagingParameters;
*/
public class XmpImagingParameters<E extends XmpImagingParameters<E>> extends ImagingParameters<E> {
+ /**
+ * Constructs a new instance.
+ */
+ public XmpImagingParameters() {
+ // Default constructor
+ }
+
private String xmpXml;
/**
diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
index 0d8e0127..f951dbe2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
@@ -49,7 +49,7 @@ import org.apache.commons.imaging.palette.PaletteFactory;
import org.apache.commons.imaging.palette.SimplePalette;
/**
- * Parser for BMP (Windows Bitmap) image format.
+ * Parses the BMP (Windows Bitmap) image format.
*/
public class BmpImageParser extends AbstractImageParser<BmpImagingParameters> {
diff --git a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
index 5070c4f6..40e6ef11 100644
--- a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
@@ -41,7 +41,7 @@ import org.apache.commons.imaging.formats.pcx.PcxImageParser;
import org.apache.commons.imaging.formats.pcx.PcxImagingParameters;
/**
- * Parser for DCX (multi-page PCX) image format.
+ * Parses the DCX (multi-page PCX) image format.
*/
public class DcxImageParser extends AbstractImageParser<PcxImagingParameters> {
private static final class DcxHeader {
diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
index 252f362f..cf726d3d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
@@ -38,7 +38,7 @@ import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.ImageMetadata;
/**
- * Parser for Apple Icon Image (.icns) format.
+ * Parses the Apple Icon Image (.icns) format.
*/
public class IcnsImageParser extends AbstractImageParser<IcnsImagingParameters> {
private static final class IcnsContents {
diff --git a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
index 1d5b5a70..78935dbb 100644
--- a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
@@ -48,7 +48,7 @@ import org.apache.commons.imaging.palette.PaletteFactory;
import org.apache.commons.imaging.palette.SimplePalette;
/**
- * Parser for Windows Icon (.ico) format.
+ * Parses the Windows Icon (.ico) format.
*/
public class IcoImageParser extends AbstractImageParser<IcoImagingParameters> {
private static final class BitmapHeader {
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
index 855e06ff..e874f203 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
@@ -44,7 +44,7 @@ import org.apache.commons.imaging.formats.jpeg.JpegImagingParameters;
import org.apache.commons.imaging.internal.Debug;
/**
- * Parser for IPTC (International Press Telecommunications Council) metadata in JPEG images.
+ * Parses IPTC (International Press Telecommunications Council) metadata in JPEG images.
*/
public class IptcParser extends BinaryFileParser {
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
index 790c0bd7..8af44ff2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
@@ -40,6 +40,14 @@ public class JpegRewriter extends BinaryFileParser {
* Abstracts JFIF pieces.
*/
protected abstract static class JFIFPiece {
+
+ /**
+ * Constructs a new instance.
+ */
+ protected JFIFPiece() {
+ // Default constructor
+ }
+
@Override
public String toString() {
return "[" + this.getClass().getName() + "]";
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
index f23cc12d..255512b9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
@@ -41,7 +41,7 @@ import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.palette.PaletteFactory;
/**
- * Parser for PNM (Portable aNyMap) image format.
+ * Parses the PNM (Portable aNyMap) image format.
*/
public class PnmImageParser extends AbstractImageParser<PnmImagingParameters> {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java
index d52431c1..f90f8fb0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
/**
- * Parser for bitmap mode PSD image data.
+ * Parses bitmap mode PSD image data.
*/
public class DataParserBitmap extends AbstractDataParser {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java
index 5a30a269..0bf86038 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java
@@ -20,7 +20,7 @@ import org.apache.commons.imaging.color.ColorConversions;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
/**
- * Parser for CMYK mode PSD image data.
+ * Parses CMYK mode PSD image data.
*/
public class DataParserCmyk extends AbstractDataParser {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java
index 15b8b973..b4a80410 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
/**
- * Parser for grayscale mode PSD image data.
+ * Parses grayscale mode PSD image data.
*/
public class DataParserGrayscale extends AbstractDataParser {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java
index 5037ae40..30059601 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java
@@ -21,7 +21,7 @@ import java.util.Arrays;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
/**
- * Parser for indexed color mode PSD image data.
+ * Parses indexed color mode PSD image data.
*/
public class DataParserIndexed extends AbstractDataParser {
private final int[] colorTable;
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
index eed9b6d6..73a9ed14 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
@@ -20,7 +20,7 @@ import org.apache.commons.imaging.color.ColorConversions;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
/**
- * Parser for Lab color mode PSD image data.
+ * Parses Lab color mode PSD image data.
*/
public class DataParserLab extends AbstractDataParser {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java
index 7788d5c9..4b82ef4c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
/**
- * Parser for RGB color mode PSD image data.
+ * Parses RGB color mode PSD image data.
*/
public class DataParserRgb extends AbstractDataParser {
diff --git a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
index d09ea40c..f5bdf5c9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
@@ -38,7 +38,7 @@ import org.apache.commons.imaging.bytesource.ByteSource;
import org.apache.commons.imaging.common.ImageMetadata;
/**
- * Parser for Radiance HDR images
+ * Parses Radiance HDR images.
*/
public class RgbeImageParser extends AbstractImageParser<RgbeImagingParameters> {
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
index 052e02e3..d532a0fe 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
@@ -26,6 +26,13 @@ import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
*/
public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParameters> {
+ /**
+ * Constructs a new instance.
+ */
+ public TiffImagingParameters() {
+ // Default constructor
+ }
+
/**
* Indicates whether to read embedded thumbnails or not. Only applies to read EXIF metadata from JPEG/JFIF files.
*
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryConstants.java
index 2358938d..31ca4e2d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryConstants.java
@@ -16,23 +16,57 @@
*/
package org.apache.commons.imaging.formats.tiff.constants;
+/**
+ * Constants for TIFF directory types.
+ */
public final class TiffDirectoryConstants {
+ /** Directory type: Unknown. */
public static final int DIRECTORY_TYPE_UNKNOWN = -1;
+
+ /** Directory type: Root. */
public static final int DIRECTORY_TYPE_ROOT = 0;
+
+ /** Directory type: Sub. */
public static final int DIRECTORY_TYPE_SUB = 1;
+
+ /** Directory type: Sub0. */
public static final int DIRECTORY_TYPE_SUB0 = 1;
+
+ /** Directory type: Sub1. */
public static final int DIRECTORY_TYPE_SUB1 = 2;
+
+ /** Directory type: Sub2. */
public static final int DIRECTORY_TYPE_SUB2 = 3;
+
+ /** Directory type: Thumbnail. */
public static final int DIRECTORY_TYPE_THUMBNAIL = 2;
+
+ /** Directory type: EXIF. */
public static final int DIRECTORY_TYPE_EXIF = -2;
+
+ /** Directory type: GPS. */
public static final int DIRECTORY_TYPE_GPS = -3;
+
+ /** Directory type: Interoperability. */
public static final int DIRECTORY_TYPE_INTEROPERABILITY = -4;
+
+ /** Directory type: Maker Notes. */
public static final int DIRECTORY_TYPE_MAKER_NOTES = -5;
+
+ /** Directory type: Directory 0. */
public static final int DIRECTORY_TYPE_DIR_0 = 0;
+
+ /** Directory type: Directory 1. */
public static final int DIRECTORY_TYPE_DIR_1 = 1;
+
+ /** Directory type: Directory 2. */
public static final int DIRECTORY_TYPE_DIR_2 = 2;
+
+ /** Directory type: Directory 3. */
public static final int DIRECTORY_TYPE_DIR_3 = 3;
+
+ /** Directory type: Directory 4. */
public static final int DIRECTORY_TYPE_DIR_4 = 4;
// TODO: this should really be an enum
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryType.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryType.java
index eda61ba4..5c2e179a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryType.java
@@ -16,34 +16,68 @@
*/
package org.apache.commons.imaging.formats.tiff.constants;
+/**
+ * TIFF directory types.
+ */
public enum TiffDirectoryType {
+
+ /** TIFF directory: IFD0. */
TIFF_DIRECTORY_IFD0(true, TiffDirectoryConstants.DIRECTORY_TYPE_DIR_0, "IFD0"),
+ /** TIFF directory: IFD1. */
TIFF_DIRECTORY_IFD1(true, TiffDirectoryConstants.DIRECTORY_TYPE_DIR_1, "IFD1"),
+ /** TIFF directory: IFD2. */
TIFF_DIRECTORY_IFD2(true, TiffDirectoryConstants.DIRECTORY_TYPE_DIR_2, "IFD2"),
+ /** TIFF directory: IFD3. */
TIFF_DIRECTORY_IFD3(true, TiffDirectoryConstants.DIRECTORY_TYPE_DIR_3, "IFD3"),
+ /** EXIF directory: Interoperability IFD. */
EXIF_DIRECTORY_INTEROP_IFD(false, TiffDirectoryConstants.DIRECTORY_TYPE_INTEROPERABILITY, "Interop IFD"),
+
+ /** EXIF directory: Maker Notes. */
EXIF_DIRECTORY_MAKER_NOTES(false, TiffDirectoryConstants.DIRECTORY_TYPE_MAKER_NOTES, "Maker Notes"),
+
+ /** EXIF directory: EXIF IFD. */
EXIF_DIRECTORY_EXIF_IFD(false, TiffDirectoryConstants.DIRECTORY_TYPE_EXIF, "Exif IFD"),
+
+ /** EXIF directory: GPS IFD. */
EXIF_DIRECTORY_GPS(false, TiffDirectoryConstants.DIRECTORY_TYPE_GPS, "GPS IFD");
+ /** EXIF directory: IFD0 (alias). */
public static final TiffDirectoryType EXIF_DIRECTORY_IFD0 = TIFF_DIRECTORY_IFD0;
+
+ /** TIFF directory: Root (alias for IFD0). */
public static final TiffDirectoryType TIFF_DIRECTORY_ROOT = TIFF_DIRECTORY_IFD0;
+
+ /** EXIF directory: IFD1 (alias). */
public static final TiffDirectoryType EXIF_DIRECTORY_IFD1 = TIFF_DIRECTORY_IFD1;
+ /** EXIF directory: IFD2 (alias). */
public static final TiffDirectoryType EXIF_DIRECTORY_IFD2 = TIFF_DIRECTORY_IFD2;
+ /** EXIF directory: IFD3 (alias). */
public static final TiffDirectoryType EXIF_DIRECTORY_IFD3 = TIFF_DIRECTORY_IFD3;
+ /** EXIF directory: Sub IFD (alias for IFD1). */
public static final TiffDirectoryType EXIF_DIRECTORY_SUB_IFD = TIFF_DIRECTORY_IFD1;
+ /** EXIF directory: Sub IFD1 (alias for IFD2). */
public static final TiffDirectoryType EXIF_DIRECTORY_SUB_IFD1 = TIFF_DIRECTORY_IFD2;
+
+ /** EXIF directory: Sub IFD2 (alias for IFD3). */
public static final TiffDirectoryType EXIF_DIRECTORY_SUB_IFD2 = TIFF_DIRECTORY_IFD3;
+
+ /** EXIF directory: Unknown. */
public static final TiffDirectoryType EXIF_DIRECTORY_UNKNOWN = null;
+ /**
+ * Gets the EXIF directory type for the given type code.
+ *
+ * @param type the directory type code.
+ * @return the directory type, or {@link #EXIF_DIRECTORY_UNKNOWN} if not found.
+ */
public static TiffDirectoryType getExifDirectoryType(final int type) {
for (final TiffDirectoryType tiffDirectoryType : values()) {
@@ -55,7 +89,11 @@ public enum TiffDirectoryType {
}
private final boolean isImageDirectory;
+
+ /** The directory type code. */
public final int directoryType;
+
+ /** The directory name. */
public final String name;
TiffDirectoryType(final boolean isImageDirectory, final int directoryType, final String name) {
@@ -64,6 +102,11 @@ public enum TiffDirectoryType {
this.name = name;
}
+ /**
+ * Checks if this is an image directory.
+ *
+ * @return {@code true} if this is an image directory.
+ */
public boolean isImageDirectory() {
return isImageDirectory;
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffEpTagConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffEpTagConstants.java
index af4c8c51..de379645 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffEpTagConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffEpTagConstants.java
@@ -37,65 +37,111 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoUndefineds;
*/
public final class TiffEpTagConstants {
+ /** EXIF tag: CFA Repeat Pattern Dimension. */
public static final TagInfoShorts EXIF_TAG_CFAREPEAT_PATTERN_DIM = new TagInfoShorts("CFARepeatPatternDim", 0x828d, 2,
TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: CFA Pattern 2. */
public static final TagInfoBytes EXIF_TAG_CFAPATTERN_2 = new TagInfoBytes("CFAPattern2", 0x828e, -1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Battery Level. */
public static final TagInfoAsciiOrRational EXIF_TAG_BATTERY_LEVEL = new TagInfoAsciiOrRational("BatteryLevel", 0x828f, -1,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** EXIF tag: Inter Color Profile. */
public static final TagInfoUndefineds EXIF_TAG_INTER_COLOR_PROFILE = new TagInfoUndefineds("InterColorProfile", 0x8773, -1,
TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Interlace. */
public static final TagInfoShort EXIF_TAG_INTERLACE = new TagInfoShort("Interlace", 0x8829, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Time Zone Offset. */
public static final TagInfoSShorts EXIF_TAG_TIME_ZONE_OFFSET = new TagInfoSShorts("TimeZoneOffset", 0x882a, -1, TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
+ /** EXIF tag: Self Timer Mode. */
public static final TagInfoShort EXIF_TAG_SELF_TIMER_MODE = new TagInfoShort("SelfTimerMode", 0x882b, TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
+ /** EXIF tag: Flash Energy. */
public static final TagInfoRationals EXIF_TAG_FLASH_ENERGY = new TagInfoRationals("FlashEnergy", 0x920b, -1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Spatial Frequency Response. */
public static final TagInfoUndefineds EXIF_TAG_SPATIAL_FREQUENCY_RESPONSE_1 = new TagInfoUndefineds("SpatialFrequencyResponse", 0x920c, -1,
TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Noise. */
public static final TagInfoUndefineds EXIF_TAG_NOISE_1 = new TagInfoUndefineds("Noise", 0x920d, -1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Focal Plane X Resolution. */
public static final TagInfoRational EXIF_TAG_FOCAL_PLANE_XRESOLUTION = new TagInfoRational("FocalPlaneXResolution", 0x920e,
TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Focal Plane Y Resolution. */
public static final TagInfoRational EXIF_TAG_FOCAL_PLANE_YRESOLUTION = new TagInfoRational("FocalPlaneYResolution", 0x920f,
TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Focal Plane Resolution Unit. */
public static final TagInfoShort EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT = new TagInfoShort("FocalPlaneResolutionUnit", 0x9210,
TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+
+ /** Focal plane resolution unit: None. */
public static final int FOCAL_PLANE_RESOLUTION_UNIT_VALUE_NONE = 1;
+
+ /** Focal plane resolution unit: Inches. */
public static final int FOCAL_PLANE_RESOLUTION_UNIT_VALUE_INCHES = 2;
+
+ /** Focal plane resolution unit: Centimeters. */
public static final int FOCAL_PLANE_RESOLUTION_UNIT_VALUE_CM = 3;
+
+ /** Focal plane resolution unit: Millimeters. */
public static final int FOCAL_PLANE_RESOLUTION_UNIT_VALUE_MM = 4;
+
+ /** Focal plane resolution unit: Micrometers. */
public static final int FOCAL_PLANE_RESOLUTION_UNIT_VALUE_UM = 5;
+ /** EXIF tag: Image Number. */
public static final TagInfoLong EXIF_TAG_IMAGE_NUMBER_EXIF_IFD = new TagInfoLong("ImageNumber", 0x9211, TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
+ /** EXIF tag: Security Classification. */
public static final TagInfoAscii EXIF_TAG_SECURITY_CLASSIFICATION_EXIF_IFD = new TagInfoAscii("SecurityClassification", 0x9212, -1,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
+ /** EXIF tag: Image History. */
public static final TagInfoAscii EXIF_TAG_IMAGE_HISTORY_EXIF_IFD = new TagInfoAscii("ImageHistory", 0x9213, -1, TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
+ /** EXIF tag: Exposure Index. */
public static final TagInfoRationals EXIF_TAG_EXPOSURE_INDEX = new TagInfoRationals("ExposureIndex", 0x9215, -1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: TIFF/EP Standard ID. */
public static final TagInfoBytes EXIF_TAG_TIFF_EPSTANDARD_ID_1 = new TagInfoBytes("TIFF/EPStandardID", 0x9216, 4, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** EXIF tag: Sensing Method. */
public static final TagInfoShort EXIF_TAG_SENSING_METHOD = new TagInfoShort("SensingMethod", 0x9217, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+
+ /** Sensing method: Monochrome area. */
public static final int SENSING_METHOD_VALUE_MONOCHROME_AREA = 1;
+
+ /** Sensing method: One-chip color area. */
public static final int SENSING_METHOD_VALUE_ONE_CHIP_COLOR_AREA = 2;
+
+ /** Sensing method: Two-chip color area. */
public static final int SENSING_METHOD_VALUE_TWO_CHIP_COLOR_AREA = 3;
+
+ /** Sensing method: Three-chip color area. */
public static final int SENSING_METHOD_VALUE_THREE_CHIP_COLOR_AREA = 4;
+
+ /** Sensing method: Color sequential area. */
public static final int SENSING_METHOD_VALUE_COLOR_SEQUENTIAL_AREA = 5;
+
+ /** Sensing method: Monochrome linear. */
public static final int SENSING_METHOD_VALUE_MONOCHROME_LINEAR = 6;
+
+ /** Sensing method: Trilinear. */
public static final int SENSING_METHOD_VALUE_TRILINEAR = 7;
+
+ /** Sensing method: Color sequential linear. */
public static final int SENSING_METHOD_VALUE_COLOR_SEQUENTIAL_LINEAR = 8;
+ /** List of all TIFF/EP tags. */
public static final List<TagInfo> ALL_TIFF_EP_TAGS = Collections.unmodifiableList(Arrays.asList(EXIF_TAG_CFAREPEAT_PATTERN_DIM, EXIF_TAG_CFAPATTERN_2,
EXIF_TAG_BATTERY_LEVEL, EXIF_TAG_INTER_COLOR_PROFILE, EXIF_TAG_INTERLACE, EXIF_TAG_TIME_ZONE_OFFSET, EXIF_TAG_SELF_TIMER_MODE,
EXIF_TAG_FLASH_ENERGY, EXIF_TAG_SPATIAL_FREQUENCY_RESPONSE_1, EXIF_TAG_NOISE_1, EXIF_TAG_FOCAL_PLANE_XRESOLUTION, EXIF_TAG_FOCAL_PLANE_YRESOLUTION,
diff --git a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
index 7ff77f16..501dca2a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
@@ -40,7 +40,7 @@ import org.apache.commons.imaging.bytesource.ByteSource;
import org.apache.commons.imaging.common.ImageMetadata;
/**
- * Parser for Wireless Bitmap (WBMP) images.
+ * Parses Wireless Bitmap (WBMP) images.
*/
public class WbmpImageParser extends AbstractImageParser<WbmpImagingParameters> {
diff --git a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImagingParameters.java
index 41695db5..e99a9d46 100644
--- a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImagingParameters.java
@@ -23,5 +23,11 @@ import org.apache.commons.imaging.ImagingParameters;
* @since 1.0-alpha3
*/
public class WbmpImagingParameters extends ImagingParameters<WbmpImagingParameters> {
- // empty
+
+ /**
+ * Constructs a new instance.
+ */
+ public WbmpImagingParameters() {
+ // Default constructor
+ }
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/WebPImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/webp/WebPImagingParameters.java
index dc1c7dfd..5c00f485 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/WebPImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/WebPImagingParameters.java
@@ -24,4 +24,11 @@ import org.apache.commons.imaging.common.XmpImagingParameters;
* @since 1.0.0-alpha4
*/
public class WebPImagingParameters extends XmpImagingParameters<WebPImagingParameters> {
+
+ /**
+ * Constructs a new instance.
+ */
+ public WebPImagingParameters() {
+ // Default constructor
+ }
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index 5ca76c33..083dc0e5 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -47,7 +47,7 @@ import org.apache.commons.imaging.common.BasicCParser;
import org.apache.commons.imaging.common.ImageMetadata;
/**
- * Parser for X BitMap (XBM) image format.
+ * Parses the X BitMap (XBM) image format.
*/
public class XbmImageParser extends AbstractImageParser<XbmImagingParameters> {
diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImagingParameters.java
index 192d8376..50c56a6a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImagingParameters.java
@@ -23,5 +23,11 @@ import org.apache.commons.imaging.ImagingParameters;
* @since 1.0-alpha3
*/
public class XbmImagingParameters extends ImagingParameters<XbmImagingParameters> {
- // empty
+
+ /**
+ * Constructs a new instance.
+ */
+ public XbmImagingParameters() {
+ // Default constructor
+ }
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index 5bcd7721..24546daf 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -52,7 +52,7 @@ import org.apache.commons.imaging.palette.SimplePalette;
import org.apache.commons.lang3.StringUtils;
/**
- * Parser for X PixMap (XPM) image format.
+ * Parses the X PixMap (XPM) image format.
*/
public class XpmImageParser extends AbstractImageParser<XpmImagingParameters> {
diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImagingParameters.java
index 67a9ea33..f6716c9b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImagingParameters.java
@@ -22,5 +22,11 @@ import org.apache.commons.imaging.ImagingParameters;
* @since 1.0-alpha3
*/
public class XpmImagingParameters extends ImagingParameters<XpmImagingParameters> {
- // empty
+
+ /**
+ * Constructs a new instance.
+ */
+ public XpmImagingParameters() {
+ // Default constructor
+ }
}
(commons-imaging) 03/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 53fcb473ccaff8a52a7e1c6a9dee85ded845d615
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 08:22:37 2026 -0500
Javadoc
---
.../imaging/formats/tiff/TiffDirectory.java | 3 +
.../commons/imaging/formats/tiff/TiffField.java | 140 +++++++++++++++++++--
.../commons/imaging/formats/tiff/TiffHeader.java | 27 ++++
.../imaging/formats/tiff/TiffImageMetadata.java | 42 +++++++
4 files changed, 201 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
index 0b7fa4df..d09c15ad 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
@@ -64,6 +64,9 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoXpString;
*/
public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffField> {
+ /**
+ * An element containing image data within a TIFF directory.
+ */
public static final class ImageDataElement extends AbstractTiffElement {
/**
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java
index a1a68100..6456b946 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java
@@ -41,7 +41,17 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
*/
public class TiffField {
+ /**
+ * Represents an oversized field value that is stored outside the IFD entry.
+ */
public final class OversizeValueElement extends AbstractTiffElement {
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param offset the offset.
+ * @param length the length.
+ */
public OversizeValueElement(final int offset, final int length) {
super(offset, length);
}
@@ -53,6 +63,7 @@ public class TiffField {
}
private static final Logger LOGGER = Logger.getLogger(TiffField.class.getName());
+
private final TagInfo tagInfo;
private final int tag;
private final int directoryType;
@@ -61,9 +72,20 @@ public class TiffField {
private final long offset;
private final byte[] value;
private final ByteOrder byteOrder;
-
private final int sortHint;
+ /**
+ * Constructs a new instance.
+ *
+ * @param tag the tag number.
+ * @param directoryType the directory type.
+ * @param abstractFieldType the field type.
+ * @param count the count.
+ * @param offset the offset.
+ * @param value the value bytes.
+ * @param byteOrder the byte order.
+ * @param sortHint the sort hint.
+ */
public TiffField(final int tag, final int directoryType, final AbstractFieldType abstractFieldType, final long count, final long offset, final byte[] value,
final ByteOrder byteOrder, final int sortHint) {
@@ -79,6 +101,9 @@ public class TiffField {
tagInfo = TiffTags.getTag(directoryType, tag);
}
+ /**
+ * Dumps field information to the logger.
+ */
public void dump() {
try (StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw)) {
@@ -91,10 +116,21 @@ public class TiffField {
}
}
+ /**
+ * Dumps field information to a PrintWriter.
+ *
+ * @param pw the PrintWriter.
+ */
public void dump(final PrintWriter pw) {
dump(pw, null);
}
+ /**
+ * Dumps field information to a PrintWriter with an optional prefix.
+ *
+ * @param pw the PrintWriter.
+ * @param prefix the prefix string, or null.
+ */
public void dump(final PrintWriter pw, final String prefix) {
if (prefix != null) {
pw.print(prefix + ": ");
@@ -105,7 +141,7 @@ public class TiffField {
}
/**
- * Returns a copy of the raw value of the field.
+ * Gets a copy of the raw value of the field.
*
* @return the value of the field, in the byte order of the field.
*/
@@ -114,7 +150,7 @@ public class TiffField {
}
/**
- * Returns the field's byte order.
+ * Gets the field's byte order.
*
* @return the byte order
*/
@@ -123,7 +159,7 @@ public class TiffField {
}
/**
- * The length of the field's value.
+ * Gets the length of the field's value.
*
* @return the length, in bytes.
*/
@@ -132,7 +168,7 @@ public class TiffField {
}
/**
- * Returns the field's count, derived from bytes 4-7.
+ * Gets the field's count, derived from bytes 4-7.
*
* @return the count
*/
@@ -140,14 +176,30 @@ public class TiffField {
return count;
}
+ /**
+ * Gets a description of this field without the value.
+ *
+ * @return the description.
+ */
public String getDescriptionWithoutValue() {
return getTag() + " (0x" + Integer.toHexString(getTag()) + ": " + getTagInfo().name + "): ";
}
+ /**
+ * Gets the directory type.
+ *
+ * @return the directory type.
+ */
public int getDirectoryType() {
return directoryType;
}
+ /**
+ * Gets the field value as a double array.
+ *
+ * @return the double array value.
+ * @throws ImagingException if the value cannot be converted.
+ */
public double[] getDoubleArrayValue() throws ImagingException {
final Object o = getValue();
// if (o == null)
@@ -189,6 +241,12 @@ public class TiffField {
// return null;
}
+ /**
+ * Gets the field value as a single double.
+ *
+ * @return the double value.
+ * @throws ImagingException if the value is missing or cannot be converted.
+ */
public double getDoubleValue() throws ImagingException {
final Object o = getValue();
if (o == null) {
@@ -199,7 +257,7 @@ public class TiffField {
}
/**
- * Returns the field's type, derived from bytes 2-3.
+ * Gets the field's type, derived from bytes 2-3.
*
* @return the field's type, as a {@code FieldType} object.
*/
@@ -207,10 +265,21 @@ public class TiffField {
return abstractFieldType;
}
+ /**
+ * Gets the field type name.
+ *
+ * @return the field type name.
+ */
public String getFieldTypeName() {
return getFieldType().getName();
}
+ /**
+ * Gets the field value as an int array.
+ *
+ * @return the int array value.
+ * @throws ImagingException if the value cannot be converted.
+ */
public int[] getIntArrayValue() throws ImagingException {
final Object o = getValue();
// if (o == null)
@@ -248,6 +317,12 @@ public class TiffField {
// return null;
}
+ /**
+ * Gets the field value as a single int.
+ *
+ * @return the int value.
+ * @throws ImagingException if the value is missing or cannot be converted.
+ */
public int getIntValue() throws ImagingException {
final Object o = getValue();
if (o == null) {
@@ -257,6 +332,12 @@ public class TiffField {
return ((Number) o).intValue();
}
+ /**
+ * Gets the int value or sum of array values.
+ *
+ * @return the int value or sum.
+ * @throws ImagingException if an error occurs.
+ */
public int getIntValueOrArraySum() throws ImagingException {
final Object o = getValue();
// if (o == null)
@@ -346,26 +427,42 @@ public class TiffField {
}
/**
- * Returns the TIFF field's offset/value field, derived from bytes 8-11.
+ * Gets the TIFF field's offset/value field, derived from bytes 8-11.
*
* @return the field's offset in a {@code long} of 4 packed bytes, or its inlined value <= 4 bytes long encoded in the field's byte order.
*/
- public int getOffset() {
+ public long getOffset() {
return (int) offset;
}
+ /**
+ * Gets the oversized value element if this field has one.
+ *
+ * @return the oversized value element, or null.
+ */
public AbstractTiffElement getOversizeValueElement() {
if (isLocalValue()) {
return null;
}
- return new OversizeValueElement(getOffset(), value.length);
+ return new OversizeValueElement((int) getOffset(), value.length);
}
+ /**
+ * Gets the sort hint for ordering fields.
+ *
+ * @return the sort hint.
+ */
public int getSortHint() {
return sortHint;
}
+ /**
+ * Gets the field's string value.
+ *
+ * @return the string value.
+ * @throws ImagingException if an error occurs.
+ */
public String getStringValue() throws ImagingException {
final Object o = getValue();
if (o == null) {
@@ -378,18 +475,28 @@ public class TiffField {
}
/**
- * Returns the field's tag, derived from bytes 0-1.
+ * Gets the field's tag, derived from bytes 0-1.
*
- * @return the tag, as an {@code int} in which only the lowest 2 bytes are set
+ * @return the tag, as an {@code int} in which only the lowest 2 bytes are set.
*/
public int getTag() {
return tag;
}
+ /**
+ * Gets tag information.
+ *
+ * @return the tag info.
+ */
public TagInfo getTagInfo() {
return tagInfo;
}
+ /**
+ * Gets the tag name.
+ *
+ * @return the tag name.
+ */
public String getTagName() {
if (getTagInfo() == TiffTagConstants.TIFF_TAG_UNKNOWN) {
return getTagInfo().name + " (0x" + Integer.toHexString(getTag()) + ")";
@@ -397,11 +504,22 @@ public class TiffField {
return getTagInfo().name;
}
+ /**
+ * Gets the value of the field.
+ *
+ * @return the value of the field.
+ * @throws ImagingException if an error occurs.
+ */
public Object getValue() throws ImagingException {
// System.out.print("getValue");
return getTagInfo().getValue(this);
}
+ /**
+ * Gets a description of the field's value.
+ *
+ * @return the value description.
+ */
public String getValueDescription() {
try {
return getValueDescription(getValue());
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java
index c78954d3..3e6cc227 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java
@@ -20,12 +20,39 @@ import java.nio.ByteOrder;
import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
+/**
+ * The header of a TIFF file.
+ */
public class TiffHeader extends AbstractTiffElement {
+
+ /**
+ * The byte order used in the TIFF file.
+ */
public final ByteOrder byteOrder;
+
+ /**
+ * The TIFF version number.
+ */
public final int tiffVersion;
+
+ /**
+ * The offset to the first Image File Directory (IFD).
+ */
public final long offsetToFirstIFD;
+
+ /**
+ * Whether this is a BigTIFF file.
+ */
public final boolean bigTiff;
+ /**
+ * Constructs a new instance.
+ *
+ * @param byteOrder the byte order.
+ * @param tiffVersion the TIFF version.
+ * @param offsetToFirstIFD the offset to the first IFD.
+ * @param bigTiff whether this is a BigTIFF file.
+ */
public TiffHeader(final ByteOrder byteOrder, final int tiffVersion, final long offsetToFirstIFD, final boolean bigTiff) {
super(0, TiffConstants.HEADER_SIZE);
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
index 95474a48..dd68bc05 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
@@ -47,15 +47,31 @@ import org.apache.commons.imaging.formats.tiff.write.TiffOutputDirectory;
import org.apache.commons.imaging.formats.tiff.write.TiffOutputField;
import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
+/**
+ * TIFF image metadata.
+ */
public class TiffImageMetadata extends GenericImageMetadata {
+
+ /**
+ * Represents a TIFF directory as metadata.
+ */
public static class Directory extends GenericImageMetadata implements ImageMetadataItem {
// private BufferedImage thumbnail;
+ /**
+ * The directory type.
+ */
public final int type;
private final TiffDirectory directory;
private final ByteOrder byteOrder;
+ /**
+ * Constructs a new instance.
+ *
+ * @param byteOrder the byte order.
+ * @param directory the TIFF directory.
+ */
public Directory(final ByteOrder byteOrder, final TiffDirectory directory) {
this.type = directory.type;
this.directory = directory;
@@ -129,10 +145,22 @@ public class TiffImageMetadata extends GenericImageMetadata {
}
}
+ /**
+ * Gets the thumbnail image.
+ *
+ * @return the thumbnail image.
+ * @throws ImagingException if an imaging error occurs.
+ * @throws IOException if an I/O error occurs.
+ */
public BufferedImage getThumbnail() throws ImagingException, IOException {
return directory.getTiffImage(byteOrder);
}
+ /**
+ * Gets the TIFF image data.
+ *
+ * @return the TIFF image data.
+ */
public AbstractTiffImageData getTiffImageData() {
return directory.getTiffImageData();
}
@@ -183,6 +211,12 @@ public class TiffImageMetadata extends GenericImageMetadata {
throw new ImagingException("Unknown latitude ref: \"" + latitudeRef + "\"");
}
+ /**
+ * Gets the longitude as degrees east.
+ *
+ * @return the longitude in degrees east (negative for west).
+ * @throws ImagingException if the longitude reference is invalid.
+ */
public double getLongitudeAsDegreesEast() throws ImagingException {
final double result = longitudeDegrees.doubleValue() + longitudeMinutes.doubleValue() / 60.0 + longitudeSeconds.doubleValue() / 3600.0;
@@ -209,9 +243,17 @@ public class TiffImageMetadata extends GenericImageMetadata {
}
+ /**
+ * Represents a single TIFF metadata item.
+ */
public static class TiffMetadataItem extends GenericImageMetadataItem {
private final TiffField entry;
+ /**
+ * Constructs a new instance.
+ *
+ * @param entry the TIFF field.
+ */
public TiffMetadataItem(final TiffField entry) {
// super(entry.getTagName() + " (" + entry.getFieldTypeName() + ")",
super(entry.getTagName(), entry.getValueDescription());
(commons-imaging) 08/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 04efa4ca578082343c86c03836fa2d311b2b8132
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:21 2026 -0500
Javadoc
---
.../formats/tiff/constants/TiffTagConstants.java | 271 +++++++++++++++++++++
.../formats/tiff/constants/WangTagConstants.java | 2 +
2 files changed, 273 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffTagConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffTagConstants.java
index 6d559ad2..8dface89 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffTagConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffTagConstants.java
@@ -42,266 +42,537 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoUnknowns;
*/
public final class TiffTagConstants {
+ /** TIFF tag: New Subfile Type. */
public static final TagInfoLong TIFF_TAG_NEW_SUBFILE_TYPE = new TagInfoLong("NewSubfileType", 0xFE, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Subfile type: Full resolution image. */
public static final int SUBFILE_TYPE_VALUE_FULL_RESOLUTION_IMAGE = 0;
+
+ /** Subfile type: Reduced resolution image. */
public static final int SUBFILE_TYPE_VALUE_REDUCED_RESOLUTION_IMAGE = 1;
+
+ /** Subfile type: Single page of multi-page image. */
public static final int SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_IMAGE = 2;
+
+ /** Subfile type: Single page of multi-page reduced resolution image. */
public static final int SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_REDUCED_RESOLUTION_IMAGE = 3;
+
+ /** Subfile type: Transparency mask. */
public static final int SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK = 4;
+
+ /** Subfile type: Transparency mask of reduced resolution image. */
public static final int SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_REDUCED_RESOLUTION_IMAGE = 5;
+
+ /** Subfile type: Transparency mask of multi-page image. */
public static final int SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_MULTI_PAGE_IMAGE = 6;
+
+ /** Subfile type: Transparency mask of reduced resolution multi-page image. */
public static final int SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_REDUCED_RESOLUTION_MULTI_PAGE_IMAGE = 7;
+ /** TIFF tag: Subfile Type (deprecated). */
public static final TagInfoShort TIFF_TAG_SUBFILE_TYPE = new TagInfoShort("SubfileType", 0xFF, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Old subfile type: Full resolution image. */
public static final int OLD_SUBFILE_TYPE_VALUE_FULL_RESOLUTION_IMAGE = 1;
+
+ /** Old subfile type: Reduced resolution image. */
public static final int OLD_SUBFILE_TYPE_VALUE_REDUCED_RESOLUTION_IMAGE = 2;
+
+ /** Old subfile type: Single page of multi-page image. */
public static final int OLD_SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_IMAGE = 3;
+ /** TIFF tag: Image Width. */
public static final TagInfoShortOrLong TIFF_TAG_IMAGE_WIDTH = new TagInfoShortOrLong("ImageWidth", 0x100, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Image Length. */
public static final TagInfoShortOrLong TIFF_TAG_IMAGE_LENGTH = new TagInfoShortOrLong("ImageLength", 0x101, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Bits Per Sample. */
public static final TagInfoShorts TIFF_TAG_BITS_PER_SAMPLE = new TagInfoShorts("BitsPerSample", 0x102, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Compression. */
public static final TagInfoShort TIFF_TAG_COMPRESSION = new TagInfoShort("Compression", 0x103, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Compression value: uncompressed. */
public static final int COMPRESSION_VALUE_UNCOMPRESSED = 1;
+
+ /** Compression value: CCITT 1D. */
public static final int COMPRESSION_VALUE_CCITT_1D = 2;
+
+ /** Compression value: T4/Group 3 Fax. */
public static final int COMPRESSION_VALUE_T4_GROUP_3_FAX = 3;
+
+ /** Compression value: T6/Group 4 Fax. */
public static final int COMPRESSION_VALUE_T6_GROUP_4_FAX = 4;
+
+ /** Compression value: LZW. */
public static final int COMPRESSION_VALUE_LZW = 5;
+
+ /** Compression value: JPEG (old-style). */
public static final int COMPRESSION_VALUE_JPEG_OLD_STYLE = 6;
+
+ /** Compression value: JPEG. */
public static final int COMPRESSION_VALUE_JPEG = 7;
+
+ /** Compression value: Adobe Deflate. */
public static final int COMPRESSION_VALUE_ADOBE_DEFLATE = 8;
+
+ /** Compression value: JBIG B&W. */
public static final int COMPRESSION_VALUE_JBIG_B_AND_W = 9;
+
+ /** Compression value: JBIG Color. */
public static final int COMPRESSION_VALUE_JBIG_COLOR = 10;
+
+ /** Compression value: NeXT. */
public static final int COMPRESSION_VALUE_NEXT = 32766;
+
+ /** Compression value: Epson ERF Compressed. */
public static final int COMPRESSION_VALUE_EPSON_ERF_COMPRESSED = 32769;
+
+ /** Compression value: CCIRLEW. */
public static final int COMPRESSION_VALUE_CCIRLEW = 32771;
+
+ /** Compression value: PackBits. */
public static final int COMPRESSION_VALUE_PACK_BITS = 32773;
+
+ /** Compression value: Thunderscan. */
public static final int COMPRESSION_VALUE_THUNDERSCAN = 32809;
+
+ /** Compression value: IT8CTPAD. */
public static final int COMPRESSION_VALUE_IT8CTPAD = 32895;
+
+ /** Compression value: IT8LW. */
public static final int COMPRESSION_VALUE_IT8LW = 32896;
+
+ /** Compression value: IT8MP. */
public static final int COMPRESSION_VALUE_IT8MP = 32897;
+
+ /** Compression value: IT8BL. */
public static final int COMPRESSION_VALUE_IT8BL = 32898;
+
+ /** Compression value: Pixar Film. */
public static final int COMPRESSION_VALUE_PIXAR_FILM = 32908;
+
+ /** Compression value: Pixar Log. */
public static final int COMPRESSION_VALUE_PIXAR_LOG = 32909;
+
+ /** Compression value: Deflate. */
public static final int COMPRESSION_VALUE_DEFLATE = 32946;
+
+ /** Compression value: DCS. */
public static final int COMPRESSION_VALUE_DCS = 32947;
+
+ /** Compression value: JBIG. */
public static final int COMPRESSION_VALUE_JBIG = 34661;
+
+ /** Compression value: SGILog. */
public static final int COMPRESSION_VALUE_SGILOG = 34676;
+
+ /** Compression value: SGILog 24. */
public static final int COMPRESSION_VALUE_SGILOG_24 = 34677;
+
+ /** Compression value: JPEG 2000. */
public static final int COMPRESSION_VALUE_JPEG_2000 = 34712;
+
+ /** Compression value: Nikon NEF Compressed. */
public static final int COMPRESSION_VALUE_NIKON_NEF_COMPRESSED = 34713;
+
+ /** Compression value: Kodak DCR Compressed. */
public static final int COMPRESSION_VALUE_KODAK_DCR_COMPRESSED = 65000;
+
+ /** Compression value: Pentax PEF Compressed. */
public static final int COMPRESSION_VALUE_PENTAX_PEF_COMPRESSED = 65535;
+ /** TIFF tag: Photometric Interpretation. */
public static final TagInfoShort TIFF_TAG_PHOTOMETRIC_INTERPRETATION = new TagInfoShort("PhotometricInterpretation", 0x106,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Photometric interpretation value: WhiteIsZero. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_WHITE_IS_ZERO = 0;
+
+ /** Photometric interpretation value: BlackIsZero. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_BLACK_IS_ZERO = 1;
+
+ /** Photometric interpretation value: RGB. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_RGB = 2;
+
+ /** Photometric interpretation value: RGB Palette. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_RGB_PALETTE = 3;
+
+ /** Photometric interpretation value: Transparency Mask. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_TRANSPARENCY_MASK = 4;
+
+ /** Photometric interpretation value: CMYK. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_CMYK = 5;
+
+ /** Photometric interpretation value: YCbCr. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_YCB_CR = 6;
+
+ /** Photometric interpretation value: CIELab. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_CIELAB = 8;
+
+ /** Photometric interpretation value: ICCLab. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_ICCLAB = 9;
+
+ /** Photometric interpretation value: ITULab. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_ITULAB = 10;
+
+ /** Photometric interpretation value: Color Filter Array. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_COLOR_FILTER_ARRAY = 32803;
+
+ /** Photometric interpretation value: Pixar LogL. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_PIXAR_LOG_L = 32844;
+
+ /** Photometric interpretation value: Pixar LogLuv. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_PIXAR_LOG_LUV = 32845;
+
+ /** Photometric interpretation value: Linear Raw. */
public static final int PHOTOMETRIC_INTERPRETATION_VALUE_LINEAR_RAW = 34892;
+ /** TIFF tag: Threshholding. */
public static final TagInfoShort TIFF_TAG_THRESHHOLDING = new TagInfoShort("Threshholding", 0x107, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Thresholding value: No dithering or halftoning. */
public static final int THRESHOLDING_VALUE_NO_DITHERING_OR_HALFTONING = 1;
+
+ /** Thresholding value: Ordered dither or halftone. */
public static final int THRESHOLDING_VALUE_ORDERED_DITHER_OR_HALFTONE = 2;
+
+ /** Thresholding value: Randomized dither. */
public static final int THRESHOLDING_VALUE_RANDOMIZED_DITHER = 3;
+ /** TIFF tag: Cell Width. */
public static final TagInfoShort TIFF_TAG_CELL_WIDTH = new TagInfoShort("CellWidth", 0x108, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Cell Length. */
public static final TagInfoShort TIFF_TAG_CELL_LENGTH = new TagInfoShort("CellLength", 0x109, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Fill Order. */
public static final TagInfoShort TIFF_TAG_FILL_ORDER = new TagInfoShort("FillOrder", 0x10A, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Fill order value: Normal. */
public static final int FILL_ORDER_VALUE_NORMAL = 1;
+
+ /** Fill order value: Reversed. */
public static final int FILL_ORDER_VALUE_REVERSED = 2;
+ /** TIFF tag: Document Name. */
public static final TagInfoAscii TIFF_TAG_DOCUMENT_NAME = new TagInfoAscii("DocumentName", 0x10D, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Image Description. */
public static final TagInfoAscii TIFF_TAG_IMAGE_DESCRIPTION = new TagInfoAscii("ImageDescription", 0x10E, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Make. */
public static final TagInfoAscii TIFF_TAG_MAKE = new TagInfoAscii("Make", 0x10F, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Model. */
public static final TagInfoAscii TIFF_TAG_MODEL = new TagInfoAscii("Model", 0x110, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Strip Offsets. */
public static final TagInfoShortOrLong TIFF_TAG_STRIP_OFFSETS = new TagInfoShortOrLong("StripOffsets", 0x111, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT,
true);
+ /** TIFF tag: Orientation. */
public static final TagInfoShort TIFF_TAG_ORIENTATION = new TagInfoShort("Orientation", 0x112, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Orientation: Horizontal (normal). */
public static final int ORIENTATION_VALUE_HORIZONTAL_NORMAL = 1;
+
+ /** Orientation: Mirror horizontal. */
public static final int ORIENTATION_VALUE_MIRROR_HORIZONTAL = 2;
+
+ /** Orientation: Rotate 180. */
public static final int ORIENTATION_VALUE_ROTATE_180 = 3;
+
+ /** Orientation: Mirror vertical. */
public static final int ORIENTATION_VALUE_MIRROR_VERTICAL = 4;
+
+ /** Orientation: Mirror horizontal and rotate 270 CW. */
public static final int ORIENTATION_VALUE_MIRROR_HORIZONTAL_AND_ROTATE_270_CW = 5;
+
+ /** Orientation: Rotate 90 CW. */
public static final int ORIENTATION_VALUE_ROTATE_90_CW = 6;
+
+ /** Orientation: Mirror horizontal and rotate 90 CW. */
public static final int ORIENTATION_VALUE_MIRROR_HORIZONTAL_AND_ROTATE_90_CW = 7;
+
+ /** Orientation: Rotate 270 CW. */
public static final int ORIENTATION_VALUE_ROTATE_270_CW = 8;
+ /** TIFF tag: Samples Per Pixel. */
public static final TagInfoShort TIFF_TAG_SAMPLES_PER_PIXEL = new TagInfoShort("SamplesPerPixel", 0x115, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Rows Per Strip. */
public static final TagInfoShortOrLong TIFF_TAG_ROWS_PER_STRIP = new TagInfoShortOrLong("RowsPerStrip", 0x116, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Strip Byte Counts. */
public static final TagInfoShortOrLong TIFF_TAG_STRIP_BYTE_COUNTS = new TagInfoShortOrLong("StripByteCounts", 0x117, -1,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Min Sample Value. */
public static final TagInfoShorts TIFF_TAG_MIN_SAMPLE_VALUE = new TagInfoShorts("MinSampleValue", 0x118, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Max Sample Value. */
public static final TagInfoShorts TIFF_TAG_MAX_SAMPLE_VALUE = new TagInfoShorts("MaxSampleValue", 0x119, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: X Resolution. */
public static final TagInfoRational TIFF_TAG_XRESOLUTION = new TagInfoRational("XResolution", 0x11A, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Y Resolution. */
public static final TagInfoRational TIFF_TAG_YRESOLUTION = new TagInfoRational("YResolution", 0x11B, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Planar Configuration. */
public static final TagInfoShort TIFF_TAG_PLANAR_CONFIGURATION = new TagInfoShort("PlanarConfiguration", 0x11C, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Planar configuration: Chunky. */
public static final int PLANAR_CONFIGURATION_VALUE_CHUNKY = 1;
+
+ /** Planar configuration: Planar. */
public static final int PLANAR_CONFIGURATION_VALUE_PLANAR = 2;
+ /** TIFF tag: Page Name. */
public static final TagInfoAscii TIFF_TAG_PAGE_NAME = new TagInfoAscii("PageName", 0x11D, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: X Position. */
public static final TagInfoRationals TIFF_TAG_XPOSITION = new TagInfoRationals("XPosition", 0x11E, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Y Position. */
public static final TagInfoRationals TIFF_TAG_YPOSITION = new TagInfoRationals("YPosition", 0x11F, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Free Offsets. */
public static final TagInfoLongs TIFF_TAG_FREE_OFFSETS = new TagInfoLongs("FreeOffsets", 0x120, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Free Byte Counts. */
public static final TagInfoLongs TIFF_TAG_FREE_BYTE_COUNTS = new TagInfoLongs("FreeByteCounts", 0x121, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Gray Response Unit. */
public static final TagInfoShort TIFF_TAG_GRAY_RESPONSE_UNIT = new TagInfoShort("GrayResponseUnit", 0x122, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Gray response unit value: 0.1. */
public static final int GRAY_RESPONSE_UNIT_VALUE_0_1 = 1;
+
+ /** Gray response unit value: 0.01. */
public static final int GRAY_RESPONSE_UNIT_VALUE_0_01 = 2;
+
+ /** Gray response unit value: 0.001. */
public static final int GRAY_RESPONSE_UNIT_VALUE_0_001 = 3;
+
+ /** Gray response unit value: 0.0001. */
public static final int GRAY_RESPONSE_UNIT_VALUE_0_0001 = 4;
+
+ /** Gray response unit value: 0.00001. */
public static final int GRAY_RESPONSE_UNIT_VALUE_0_00001 = 5;
+ /** TIFF tag: Gray Response Curve. */
public static final TagInfoShorts TIFF_TAG_GRAY_RESPONSE_CURVE = new TagInfoShorts("GrayResponseCurve", 0x123, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: T4 Options. */
public static final TagInfoLong TIFF_TAG_T4_OPTIONS = new TagInfoLong("T4Options", 0x124, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: T6 Options. */
public static final TagInfoLong TIFF_TAG_T6_OPTIONS = new TagInfoLong("T6Options", 0x125, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Resolution Unit. */
public static final TagInfoShort TIFF_TAG_RESOLUTION_UNIT = new TagInfoShort("ResolutionUnit", 0x128, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Resolution unit: None. */
public static final int RESOLUTION_UNIT_VALUE_NONE = 1;
+
+ /** Resolution unit: Inches. */
public static final int RESOLUTION_UNIT_VALUE_INCHES = 2;
+
+ /** Resolution unit: Centimeters. */
public static final int RESOLUTION_UNIT_VALUE_CM = 3;
+ /** TIFF tag: Page Number. */
public static final TagInfoShorts TIFF_TAG_PAGE_NUMBER = new TagInfoShorts("PageNumber", 0x129, 2, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Transfer Function. */
public static final TagInfoShorts TIFF_TAG_TRANSFER_FUNCTION = new TagInfoShorts("TransferFunction", 0x12D, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Software. */
public static final TagInfoAscii TIFF_TAG_SOFTWARE = new TagInfoAscii("Software", 0x131, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Date Time. */
public static final TagInfoAscii TIFF_TAG_DATE_TIME = new TagInfoAscii("DateTime", 0x132, 20, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Artist. */
public static final TagInfoAscii TIFF_TAG_ARTIST = new TagInfoAscii("Artist", 0x13B, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Host Computer. */
public static final TagInfoAscii TIFF_TAG_HOST_COMPUTER = new TagInfoAscii("HostComputer", 0x13C, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Predictor. */
public static final TagInfoShort TIFF_TAG_PREDICTOR = new TagInfoShort("Predictor", 0x13D, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Predictor: None. */
public static final int PREDICTOR_VALUE_NONE = 1;
+
+ /** Predictor: Horizontal differencing. */
public static final int PREDICTOR_VALUE_HORIZONTAL_DIFFERENCING = 2;
+
+ /** Predictor: Floating point differencing. */
public static final int PREDICTOR_VALUE_FLOATING_POINT_DIFFERENCING = 3;
+ /** TIFF tag: White Point. */
public static final TagInfoRationals TIFF_TAG_WHITE_POINT = new TagInfoRationals("WhitePoint", 0x13E, 2, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Primary Chromaticities. */
public static final TagInfoRationals TIFF_TAG_PRIMARY_CHROMATICITIES = new TagInfoRationals("PrimaryChromaticities", 0x13F, 6,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Color Map. */
public static final TagInfoShorts TIFF_TAG_COLOR_MAP = new TagInfoShorts("ColorMap", 0x140, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Halftone Hints. */
public static final TagInfoShorts TIFF_TAG_HALFTONE_HINTS = new TagInfoShorts("HalftoneHints", 0x141, 2, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Tile Width. */
public static final TagInfoShortOrLong TIFF_TAG_TILE_WIDTH = new TagInfoShortOrLong("TileWidth", 0x142, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Tile Length. */
public static final TagInfoShortOrLong TIFF_TAG_TILE_LENGTH = new TagInfoShortOrLong("TileLength", 0x143, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Tile Offsets. */
public static final TagInfoLongs TIFF_TAG_TILE_OFFSETS = new TagInfoLongs("TileOffsets", 0x144, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT, true);
+ /** TIFF tag: Tile Byte Counts. */
public static final TagInfoShortOrLong TIFF_TAG_TILE_BYTE_COUNTS = new TagInfoShortOrLong("TileByteCounts", 0x145, -1,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Ink Set. */
public static final TagInfoShort TIFF_TAG_INK_SET = new TagInfoShort("InkSet", 0x14C, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Ink set: CMYK. */
public static final int INK_SET_VALUE_CMYK = 1;
+
+ /** Ink set: Not CMYK. */
public static final int INK_SET_VALUE_NOT_CMYK = 2;
+ /** TIFF tag: Ink Names. */
public static final TagInfoAscii TIFF_TAG_INK_NAMES = new TagInfoAscii("InkNames", 0x14D, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Number Of Inks. */
public static final TagInfoShort TIFF_TAG_NUMBER_OF_INKS = new TagInfoShort("NumberOfInks", 0x14E, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Dot Range. */
public static final TagInfoByteOrShort TIFF_TAG_DOT_RANGE = new TagInfoByteOrShort("DotRange", 0x150, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Target Printer. */
public static final TagInfoAscii TIFF_TAG_TARGET_PRINTER = new TagInfoAscii("TargetPrinter", 0x151, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Extra Samples. */
public static final TagInfoShorts TIFF_TAG_EXTRA_SAMPLES = new TagInfoShorts("ExtraSamples", 0x152, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Extra sample: Associated alpha. */
public static final int EXTRA_SAMPLE_ASSOCIATED_ALPHA = 1;
+
+ /** Extra sample: Unassociated alpha. */
public static final int EXTRA_SAMPLE_UNASSOCIATED_ALPHA = 2;
+ /** TIFF tag: Sample Format. */
public static final TagInfoShorts TIFF_TAG_SAMPLE_FORMAT = new TagInfoShorts("SampleFormat", 0x153, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** Sample format value: Unsigned integer. */
public static final int SAMPLE_FORMAT_VALUE_UNSIGNED_INTEGER = 1;
+
+ /** Sample format value: Two's complement signed integer. */
public static final int SAMPLE_FORMAT_VALUE_TWOS_COMPLEMENT_SIGNED_INTEGER = 2;
+
+ /** Sample format value: IEEE floating point. */
public static final int SAMPLE_FORMAT_VALUE_IEEE_FLOATING_POINT = 3;
+
+ /** Sample format value: Undefined. */
public static final int SAMPLE_FORMAT_VALUE_UNDEFINED = 4;
+
+ /** Sample format value: Complex integer. */
public static final int SAMPLE_FORMAT_VALUE_COMPLEX_INTEGER = 5;
+
+ /** Sample format value: IEEE complex float (deprecated, use COMPLEX_IEEE_FLOATING_POINT). */
public static final int SAMPLE_FORMAT_VALUE_IEEE_COMPLEX_FLOAT = 6;
+ /** Sample format value: Complex IEEE floating point. */
+ public static final int SAMPLE_FORMAT_VALUE_COMPLEX_IEEE_FLOATING_POINT = 6;
+
+ /** TIFF tag: S Min Sample Value. */
public static final TagInfoAny TIFF_TAG_SMIN_SAMPLE_VALUE = new TagInfoAny("SMinSampleValue", 0x154, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: S Max Sample Value. */
public static final TagInfoAny TIFF_TAG_SMAX_SAMPLE_VALUE = new TagInfoAny("SMaxSampleValue", 0x155, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Transfer Range. */
public static final TagInfoShorts TIFF_TAG_TRANSFER_RANGE = new TagInfoShorts("TransferRange", 0x156, 6, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: JPEG Proc. */
public static final TagInfoShort TIFF_TAG_JPEG_PROC = new TagInfoShort("JPEGProc", 0x200, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** JPEG proc: Baseline. */
public static final int JPEGPROC_VALUE_BASELINE = 1;
+
+ /** JPEG proc: Lossless. */
public static final int JPEGPROC_VALUE_LOSSLESS = 14;
+ /** TIFF tag: JPEG Interchange Format. */
public static final TagInfoLong TIFF_TAG_JPEG_INTERCHANGE_FORMAT = new TagInfoLong("JPEGInterchangeFormat", 0x201, TiffDirectoryType.TIFF_DIRECTORY_ROOT,
true);
+ /** TIFF tag: JPEG Interchange Format Length. */
public static final TagInfoLong TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = new TagInfoLong("JPEGInterchangeFormatLength", 0x202,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: JPEG Restart Interval. */
public static final TagInfoShort TIFF_TAG_JPEG_RESTART_INTERVAL = new TagInfoShort("JPEGRestartInterval", 0x203, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: JPEG Lossless Predictors. */
public static final TagInfoShorts TIFF_TAG_JPEG_LOSSLESS_PREDICTORS = new TagInfoShorts("JPEGLosslessPredictors", 0x205, -1,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: JPEG Point Transforms. */
public static final TagInfoShorts TIFF_TAG_JPEG_POINT_TRANSFORMS = new TagInfoShorts("JPEGPointTransforms", 0x206, -1,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: JPEG Q Tables. */
public static final TagInfoLongs TIFF_TAG_JPEG_QTABLES = new TagInfoLongs("JPEGQTables", 0x207, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: JPEG DC Tables. */
public static final TagInfoLongs TIFF_TAG_JPEG_DCTABLES = new TagInfoLongs("JPEGDCTables", 0x208, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: JPEG AC Tables. */
public static final TagInfoLongs TIFF_TAG_JPEG_ACTABLES = new TagInfoLongs("JPEGACTables", 0x209, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: YCbCr Coefficients. */
public static final TagInfoRationals TIFF_TAG_YCBCR_COEFFICIENTS = new TagInfoRationals("YCbCrCoefficients", 0x211, 3,
TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: YCbCr Sub Sampling. */
public static final TagInfoShorts TIFF_TAG_YCBCR_SUB_SAMPLING = new TagInfoShorts("YCbCrSubSampling", 0x212, 2, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: YCbCr Positioning. */
public static final TagInfoShort TIFF_TAG_YCBCR_POSITIONING = new TagInfoShort("YCbCrPositioning", 0x213, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+ /** YCbCr positioning: Centered. */
public static final int YCB_CR_POSITIONING_VALUE_CENTERED = 1;
+
+ /** YCbCr positioning: Co-sited. */
public static final int YCB_CR_POSITIONING_VALUE_CO_SITED = 2;
+ /** TIFF tag: Reference Black White. */
public static final TagInfoLongs TIFF_TAG_REFERENCE_BLACK_WHITE = new TagInfoLongs("ReferenceBlackWhite", 0x214, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: Copyright. */
public static final TagInfoAscii TIFF_TAG_COPYRIGHT = new TagInfoAscii("Copyright", 0x8298, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+ /** TIFF tag: XMP. */
public static final TagInfoBytes TIFF_TAG_XMP = new TagInfoBytes("XMP", 0x2BC, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
// TODO:
// public static final TagInfo2 TIFF_TAG_UNKNOWN = null;
+
+ /** TIFF tag: Unknown Tag. */
public static final TagInfoUnknowns TIFF_TAG_UNKNOWN = new TagInfoUnknowns("Unknown Tag", -1, TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** List of all TIFF tags. */
public static final List<TagInfo> ALL_TIFF_TAGS = Collections.unmodifiableList(Arrays.asList(TIFF_TAG_NEW_SUBFILE_TYPE, TIFF_TAG_SUBFILE_TYPE,
TIFF_TAG_IMAGE_WIDTH, TIFF_TAG_IMAGE_LENGTH, TIFF_TAG_BITS_PER_SAMPLE, TIFF_TAG_COMPRESSION, TIFF_TAG_PHOTOMETRIC_INTERPRETATION,
TIFF_TAG_THRESHHOLDING, TIFF_TAG_CELL_WIDTH, TIFF_TAG_CELL_LENGTH, TIFF_TAG_FILL_ORDER, TIFF_TAG_DOCUMENT_NAME, TIFF_TAG_IMAGE_DESCRIPTION,
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/WangTagConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/WangTagConstants.java
index ba92d881..0d801e63 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/WangTagConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/WangTagConstants.java
@@ -28,8 +28,10 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoBytes;
*/
public final class WangTagConstants {
+ /** EXIF tag: Wang Annotation. */
public static final TagInfoBytes EXIF_TAG_WANG_ANNOTATION = new TagInfoBytes("WangAnnotation", 0x80a4, -1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+ /** List of all Wang tags. */
public static final List<TagInfo> ALL_WANG_TAGS = Collections.unmodifiableList(Arrays.<TagInfo>asList(EXIF_TAG_WANG_ANNOTATION));
private WangTagConstants() {
(commons-imaging) 13/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit a053dcd7842a7b9a113e5440d89d96f67442f58e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:54 2026 -0500
Javadoc
---
.../commons/imaging/formats/webp/WebPChunkType.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java b/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
index 61045f71..da49119e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
@@ -40,46 +40,64 @@ import org.apache.commons.imaging.formats.webp.chunks.WebPChunkXyzw;
public enum WebPChunkType {
/**
+ * Alpha channel chunk.
+ *
* @see WebPChunkAlph
*/
ALPH(WebPChunkAlph::new),
/**
+ * VP8 lossy bitstream chunk.
+ *
* @see WebPChunkVp8
*/
VP8(WebPChunkVp8::new),
/**
+ * VP8L lossless bitstream chunk.
+ *
* @see WebPChunkVp8l
*/
VP8L(WebPChunkVp8l::new),
/**
+ * VP8X extended file format chunk.
+ *
* @see WebPChunkVp8x
*/
VP8X(WebPChunkVp8x::new),
/**
+ * Animation parameters chunk.
+ *
* @see WebPChunkAnim
*/
ANIM(WebPChunkAnim::new),
/**
+ * Animation frame chunk.
+ *
* @see WebPChunkAnmf
*/
ANMF(WebPChunkAnmf::new),
/**
+ * ICC profile chunk.
+ *
* @see WebPChunkIccp
*/
ICCP(WebPChunkIccp::new),
/**
+ * EXIF metadata chunk.
+ *
* @see WebPChunkExif
*/
EXIF(WebPChunkExif::new),
/**
+ * XMP metadata chunk.
+ *
* @see WebPChunkXml
*/
XMP(WebPChunkXml::new);
(commons-imaging) 09/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 88ae2f8de1d58c0659b6ee2b467e17cd74c3f502
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:29 2026 -0500
Javadoc
---
.../formats/tiff/write/AbstractTiffOutputItem.java | 30 ++
.../tiff/write/TiffImageWriterLossless.java | 11 +
.../formats/tiff/write/TiffImageWriterLossy.java | 11 +
.../formats/tiff/write/TiffOutputDirectory.java | 324 +++++++++++++++++++++
.../formats/tiff/write/TiffOutputField.java | 77 +++++
.../imaging/formats/tiff/write/TiffOutputSet.java | 138 +++++++++
6 files changed, 591 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffOutputItem.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffOutputItem.java
index 8362c005..764c8228 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffOutputItem.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffOutputItem.java
@@ -57,21 +57,51 @@ abstract class AbstractTiffOutputItem {
}
}
+ /**
+ * Undefined offset value constant.
+ */
public static final long UNDEFINED_VALUE = -1;
private long offset = UNDEFINED_VALUE;
+ /**
+ * Gets a description of this item.
+ *
+ * @return the item description.
+ */
public abstract String getItemDescription();
+ /**
+ * Gets the length of this item in bytes.
+ *
+ * @return the item length.
+ */
public abstract int getItemLength();
+ /**
+ * Gets the offset of this item.
+ *
+ * @return the offset.
+ */
protected long getOffset() {
return offset;
}
+ /**
+ * Sets the offset of this item.
+ *
+ * @param offset the offset.
+ */
protected void setOffset(final long offset) {
this.offset = offset;
}
+ /**
+ * Writes this item to the output stream.
+ *
+ * @param bos the output stream.
+ * @throws IOException if an I/O error occurs.
+ * @throws ImagingException if an imaging error occurs.
+ */
public abstract void writeItem(AbstractBinaryOutputStream bos) throws IOException, ImagingException;
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
index 7d349052..cc5faa51 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
@@ -82,10 +82,21 @@ public class TiffImageWriterLossless extends AbstractTiffImageWriter {
private final byte[] exifBytes;
+ /**
+ * Constructs a new instance.
+ *
+ * @param exifBytes the EXIF bytes.
+ */
public TiffImageWriterLossless(final byte[] exifBytes) {
this.exifBytes = exifBytes;
}
+ /**
+ * Constructs a new instance.
+ *
+ * @param byteOrder the byte order.
+ * @param exifBytes the EXIF bytes.
+ */
public TiffImageWriterLossless(final ByteOrder byteOrder, final byte[] exifBytes) {
super(byteOrder);
this.exifBytes = exifBytes;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
index 7f10592d..01d07340 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
@@ -26,12 +26,23 @@ import java.util.List;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
+/**
+ * TIFF lossy image writer.
+ */
public class TiffImageWriterLossy extends AbstractTiffImageWriter {
+ /**
+ * Constructs a new instance with default byte order.
+ */
public TiffImageWriterLossy() {
// with default byte order
}
+ /**
+ * Constructs a new instance with the specified byte order.
+ *
+ * @param byteOrder the byte order.
+ */
public TiffImageWriterLossy(final ByteOrder byteOrder) {
super(byteOrder);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
index 59e9419f..67ebf716 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
@@ -72,8 +72,16 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShortOrRational;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShorts;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoXpString;
+/**
+ * Represents a TIFF output directory containing fields and image data.
+ */
public final class TiffOutputDirectory extends AbstractTiffOutputItem implements Iterable<TiffOutputField> {
+
+ /**
+ * Comparator for sorting directories by type.
+ */
public static final Comparator<TiffOutputDirectory> COMPARATOR = Comparator.comparingInt(TiffOutputDirectory::getType);
+
private final int type;
private final List<TiffOutputField> fields = new ArrayList<>();
private final ByteOrder byteOrder;
@@ -81,11 +89,24 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
private JpegImageData jpegImageData;
private AbstractTiffImageData abstractTiffImageData;
+ /**
+ * Constructs a new instance.
+ *
+ * @param type the directory type.
+ * @param byteOrder the byte order.
+ */
public TiffOutputDirectory(final int type, final ByteOrder byteOrder) {
this.type = type;
this.byteOrder = byteOrder;
}
+ /**
+ * Adds an ASCII field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the string values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoAscii tagInfo, final String... values) throws ImagingException {
final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
if (tagInfo.length > 0 && tagInfo.length != bytes.length) {
@@ -95,6 +116,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds an ASCII or byte field with string values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the string values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoAsciiOrByte tagInfo, final String... values) throws ImagingException {
final byte[] bytes = tagInfo.encodeValue(AbstractFieldType.ASCII, values, byteOrder);
if (tagInfo.length > 0 && tagInfo.length != bytes.length) {
@@ -104,6 +132,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds an ASCII or rational field with rational values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the rational values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoAsciiOrRational tagInfo, final RationalNumber... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -113,6 +148,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds an ASCII or rational field with string values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the string values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoAsciiOrRational tagInfo, final String... values) throws ImagingException {
final byte[] bytes = tagInfo.encodeValue(AbstractFieldType.ASCII, values, byteOrder);
if (tagInfo.length > 0 && tagInfo.length != bytes.length) {
@@ -122,6 +164,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a byte field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the byte value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoByte tagInfo, final byte value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -131,6 +180,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a byte or short field with byte values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the byte values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoByteOrShort tagInfo, final byte... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -140,6 +196,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a byte or short field with short values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the short values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoByteOrShort tagInfo, final short... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -149,6 +212,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a bytes field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the byte values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoBytes tagInfo, final byte... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -158,6 +228,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a double field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the double value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoDouble tagInfo, final double value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -167,6 +244,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a doubles field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the double values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoDoubles tagInfo, final double... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -176,6 +260,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a float field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the float value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoFloat tagInfo, final float value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -185,6 +276,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a floats field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the float values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoFloats tagInfo, final float... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -194,12 +292,26 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a GPS text field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the string value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoGpsText tagInfo, final String value) throws ImagingException {
final byte[] bytes = tagInfo.encodeValue(AbstractFieldType.UNDEFINED, value, byteOrder);
final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag, tagInfo, tagInfo.dataTypes.get(0), bytes.length, bytes);
add(tiffOutputField);
}
+ /**
+ * Adds a long field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the int value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoLong tagInfo, final int value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -209,6 +321,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a longs field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the int values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoLongs tagInfo, final int... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -218,6 +337,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a rational field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the rational value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoRational tagInfo, final RationalNumber value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -227,6 +353,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a rationals field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the rational values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoRationals tagInfo, final RationalNumber... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -236,6 +369,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a signed byte field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the byte value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoSByte tagInfo, final byte value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -245,6 +385,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a signed bytes field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the byte values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoSBytes tagInfo, final byte... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -254,6 +401,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a short field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the short value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoShort tagInfo, final short value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -263,6 +417,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a short or long field with int values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the int values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoShortOrLong tagInfo, final int... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -272,6 +433,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a short or long field with short values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the short values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoShortOrLong tagInfo, final short... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -281,6 +449,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a short or long or rational field with int values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the int values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoShortOrLongOrRational tagInfo, final int... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -290,6 +465,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a short or long or rational field with rational values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the rational values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoShortOrLongOrRational tagInfo, final RationalNumber... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -299,6 +481,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a short or long or rational field with short values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the short values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoShortOrLongOrRational tagInfo, final short... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -308,6 +497,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a short or rational field with rational values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the rational values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoShortOrRational tagInfo, final RationalNumber... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -317,6 +513,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a short or rational field with short values.
+ *
+ * @param tagInfo the tag info.
+ * @param values the short values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoShortOrRational tagInfo, final short... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -326,6 +529,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a shorts field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the short values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoShorts tagInfo, final short... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -335,6 +545,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a signed long field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the int value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoSLong tagInfo, final int value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -344,6 +561,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a signed longs field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the int values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoSLongs tagInfo, final int... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -353,6 +577,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a signed rational field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the rational value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoSRational tagInfo, final RationalNumber value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -362,6 +593,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a signed rationals field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the rational values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoSRationals tagInfo, final RationalNumber... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -371,6 +609,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a signed short field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the short value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoSShort tagInfo, final short value) throws ImagingException {
if (tagInfo.length != 1) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not 1");
@@ -380,6 +625,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds a signed shorts field.
+ *
+ * @param tagInfo the tag info.
+ * @param values the short values.
+ * @throws ImagingException if the values are invalid.
+ */
public void add(final TagInfoSShorts tagInfo, final short... values) throws ImagingException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImagingException("Tag expects " + tagInfo.length + " value(s), not " + values.length);
@@ -389,16 +641,33 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
add(tiffOutputField);
}
+ /**
+ * Adds an XP string field.
+ *
+ * @param tagInfo the tag info.
+ * @param value the string value.
+ * @throws ImagingException if the value is invalid.
+ */
public void add(final TagInfoXpString tagInfo, final String value) throws ImagingException {
final byte[] bytes = tagInfo.encodeValue(AbstractFieldType.BYTE, value, byteOrder);
final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag, tagInfo, AbstractFieldType.BYTE, bytes.length, bytes);
add(tiffOutputField);
}
+ /**
+ * Adds a field to this directory.
+ *
+ * @param field the field to add.
+ */
public void add(final TiffOutputField field) {
fields.add(field);
}
+ /**
+ * Gets a description of this directory.
+ *
+ * @return the description.
+ */
public String description() {
return TiffDirectory.description(getType());
}
@@ -438,6 +707,11 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
return findField(tagInfo.tag);
}
+ /**
+ * Gets all fields in this directory.
+ *
+ * @return a list of all fields.
+ */
public List<TiffOutputField> getFields() {
return new ArrayList<>(fields);
}
@@ -453,6 +727,13 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
return ENTRY_LENGTH * fields.size() + DIRECTORY_HEADER_LENGTH + DIRECTORY_FOOTER_LENGTH;
}
+ /**
+ * Gets all output items from this directory including fields and image data.
+ *
+ * @param outputSummary the output summary.
+ * @return the list of output items.
+ * @throws ImagingException if an error occurs.
+ */
protected List<AbstractTiffOutputItem> getOutputItems(final TiffOutputSummary outputSummary) throws ImagingException {
// first validate directory fields.
@@ -542,14 +823,29 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
return result;
}
+ /**
+ * Gets the raw JPEG image data.
+ *
+ * @return the JPEG image data, or null if not present.
+ */
public JpegImageData getRawJpegImageData() {
return jpegImageData;
}
+ /**
+ * Gets the raw TIFF image data.
+ *
+ * @return the TIFF image data, or null if not present.
+ */
public AbstractTiffImageData getRawTiffImageData() {
return abstractTiffImageData;
}
+ /**
+ * Gets the directory type.
+ *
+ * @return the directory type.
+ */
public int getType() {
return type;
}
@@ -559,6 +855,11 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
return fields.iterator();
}
+ /**
+ * Removes a field from this directory.
+ *
+ * @param tag the tag of the field to remove.
+ */
public void removeField(final int tag) {
final List<TiffOutputField> matches = new ArrayList<>();
for (final TiffOutputField field : fields) {
@@ -569,6 +870,11 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
fields.removeAll(matches);
}
+ /**
+ * Removes a field from this directory.
+ *
+ * @param tagInfo the tag info of the field to remove.
+ */
public void removeField(final TagInfo tagInfo) {
removeField(tagInfo.tag);
}
@@ -580,18 +886,36 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
}
}
+ /**
+ * Sets the JPEG image data.
+ *
+ * @param rawJpegImageData the JPEG image data.
+ */
public void setJpegImageData(final JpegImageData rawJpegImageData) {
this.jpegImageData = rawJpegImageData;
}
+ /**
+ * Sets the next directory.
+ *
+ * @param nextDirectory the next directory.
+ */
public void setNextDirectory(final TiffOutputDirectory nextDirectory) {
this.nextDirectory = nextDirectory;
}
+ /**
+ * Sets the TIFF image data.
+ *
+ * @param rawTiffImageData the TIFF image data.
+ */
public void setTiffImageData(final AbstractTiffImageData rawTiffImageData) {
this.abstractTiffImageData = rawTiffImageData;
}
+ /**
+ * Sorts fields by tag number and sort hint.
+ */
public void sortFields() {
final Comparator<TiffOutputField> comparator = (e1, e2) -> {
if (e1.tag != e2.tag) {
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
index 4a8ff4cd..72662a9e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
@@ -27,22 +27,58 @@ import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
+/**
+ * Represents a TIFF output field.
+ */
public class TiffOutputField {
private static final String NEWLINE = System.lineSeparator();
+ /**
+ * Creates an offset field.
+ *
+ * @param tagInfo the tag info.
+ * @param byteOrder the byte order.
+ * @return the offset field.
+ * @throws ImagingException if an error occurs.
+ */
protected static TiffOutputField createOffsetField(final TagInfo tagInfo, final ByteOrder byteOrder) throws ImagingException {
return new TiffOutputField(tagInfo, AbstractFieldType.LONG, 1, AbstractFieldType.LONG.writeData(0, byteOrder));
}
+ /**
+ * The tag number.
+ */
public final int tag;
+
+ /**
+ * The tag info.
+ */
public final TagInfo tagInfo;
+
+ /**
+ * The field type.
+ */
public final AbstractFieldType abstractFieldType;
+
+ /**
+ * The value count.
+ */
public final int count;
+
private byte[] bytes;
private final AbstractTiffOutputItem.Value separateValueItem;
private int sortHint = -1;
+ /**
+ * Constructs a new instance.
+ *
+ * @param tag the tag number.
+ * @param tagInfo the tag info.
+ * @param abstractFieldType the field type.
+ * @param count the value count.
+ * @param bytes the field data.
+ */
public TiffOutputField(final int tag, final TagInfo tagInfo, final AbstractFieldType abstractFieldType, final int count, final byte[] bytes) {
this.tag = tag;
this.tagInfo = tagInfo;
@@ -58,6 +94,14 @@ public class TiffOutputField {
}
}
+ /**
+ * Constructs a new instance.
+ *
+ * @param tagInfo the tag info.
+ * @param abstractFieldType the field type.
+ * @param count the value count.
+ * @param bytes the field data.
+ */
public TiffOutputField(final TagInfo tagInfo, final AbstractFieldType abstractFieldType, final int count, final byte[] bytes) {
this(tagInfo.tag, tagInfo, abstractFieldType, count, bytes);
}
@@ -71,14 +115,29 @@ public class TiffOutputField {
return Arrays.copyOf(this.bytes, this.bytes.length);
}
+ /**
+ * Gets the separate value item if this field is not a local value.
+ *
+ * @return the separate value item, or null.
+ */
protected AbstractTiffOutputItem getSeperateValue() {
return separateValueItem;
}
+ /**
+ * Gets the sort hint.
+ *
+ * @return the sort hint.
+ */
public int getSortHint() {
return sortHint;
}
+ /**
+ * Checks if this field's value fits in the tag entry.
+ *
+ * @return true if the value is local.
+ */
protected final boolean isLocalValue() {
return bytes.length <= ENTRY_MAX_VALUE_LENGTH;
}
@@ -108,6 +167,11 @@ public class TiffOutputField {
// + tagInfo.getDescription());
}
+ /**
+ * Sets the sort hint for this field.
+ *
+ * @param sortHint the sort hint.
+ */
public void setSortHint(final int sortHint) {
this.sortHint = sortHint;
}
@@ -117,6 +181,12 @@ public class TiffOutputField {
return toString(null);
}
+ /**
+ * Gets a string representation with optional prefix.
+ *
+ * @param prefix the prefix, or null.
+ * @return the string representation.
+ */
public String toString(String prefix) {
if (prefix == null) {
prefix = "";
@@ -139,6 +209,13 @@ public class TiffOutputField {
return result.toString();
}
+ /**
+ * Writes this field to the output stream.
+ *
+ * @param bos the output stream.
+ * @throws IOException if an I/O error occurs.
+ * @throws ImagingException if an imaging error occurs.
+ */
protected void writeField(final AbstractBinaryOutputStream bos) throws IOException, ImagingException {
bos.write2Bytes(tag);
bos.write2Bytes(abstractFieldType.getType());
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
index 0d30cf82..8eaf101d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
@@ -30,20 +30,42 @@ import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryConstants;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
import org.apache.commons.imaging.internal.Debug;
+/**
+ * Represents a complete TIFF output set containing multiple directories.
+ */
public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
private static final String NEWLINE = System.lineSeparator();
+
+ /**
+ * The byte order for this output set.
+ */
public final ByteOrder byteOrder;
+
private final List<TiffOutputDirectory> directories = new ArrayList<>();
+ /**
+ * Constructs a new instance with default byte order.
+ */
public TiffOutputSet() {
this(DEFAULT_TIFF_BYTE_ORDER);
}
+ /**
+ * Constructs a new instance with the specified byte order.
+ *
+ * @param byteOrder the byte order.
+ */
public TiffOutputSet(final ByteOrder byteOrder) {
this.byteOrder = byteOrder;
}
+ /**
+ * Adds a directory to this output set.
+ *
+ * @param directory the directory to add.
+ * @throws ImagingException if a directory of that type already exists.
+ */
public void addDirectory(final TiffOutputDirectory directory) throws ImagingException {
if (null != findDirectory(directory.getType())) {
throw new ImagingException("Output set already contains a directory of that type.");
@@ -51,18 +73,36 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
directories.add(directory);
}
+ /**
+ * Adds an EXIF directory to this output set.
+ *
+ * @return the new EXIF directory.
+ * @throws ImagingException if an EXIF directory already exists.
+ */
public TiffOutputDirectory addExifDirectory() throws ImagingException {
final TiffOutputDirectory result = new TiffOutputDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_EXIF, byteOrder);
addDirectory(result);
return result;
}
+ /**
+ * Adds a GPS directory to this output set.
+ *
+ * @return the new GPS directory.
+ * @throws ImagingException if a GPS directory already exists.
+ */
public TiffOutputDirectory addGpsDirectory() throws ImagingException {
final TiffOutputDirectory result = new TiffOutputDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_GPS, byteOrder);
addDirectory(result);
return result;
}
+ /**
+ * Adds an Interoperability directory to this output set.
+ *
+ * @return the new Interoperability directory.
+ * @throws ImagingException if an Interoperability directory already exists.
+ */
public TiffOutputDirectory addInteroperabilityDirectory() throws ImagingException {
getOrCreateExifDirectory();
@@ -71,16 +111,31 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return result;
}
+ /**
+ * Adds a Root directory to this output set.
+ *
+ * @return the new Root directory.
+ * @throws ImagingException if a Root directory already exists.
+ */
public TiffOutputDirectory addRootDirectory() throws ImagingException {
final TiffOutputDirectory result = new TiffOutputDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_ROOT, byteOrder);
addDirectory(result);
return result;
}
+ /**
+ * Dumps the content of this TIFF output set to the debug output.
+ */
public void dump() {
Debug.debug(this.toString());
}
+ /**
+ * Finds a directory of the specified type in this output set.
+ *
+ * @param directoryType the type of the directory to find.
+ * @return the found directory, or null if no such directory exists.
+ */
public TiffOutputDirectory findDirectory(final int directoryType) {
for (final TiffOutputDirectory directory : directories) {
if (directory.getType() == directoryType) {
@@ -90,6 +145,12 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return null;
}
+ /**
+ * Finds a field with the specified tag in this output set.
+ *
+ * @param tag the tag of the field to find.
+ * @return the found field, or null if no such field exists.
+ */
public TiffOutputField findField(final int tag) {
for (final TiffOutputDirectory directory : directories) {
final TiffOutputField field = directory.findField(tag);
@@ -100,26 +161,58 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return null;
}
+ /**
+ * Finds a field with the specified tag info in this output set.
+ *
+ * @param tagInfo the tag info of the field to find.
+ * @return the found field, or null if no such field exists.
+ */
public TiffOutputField findField(final TagInfo tagInfo) {
return findField(tagInfo.tag);
}
+ /**
+ * Gets a list of all directories in this output set.
+ *
+ * @return a list of all directories.
+ */
public List<TiffOutputDirectory> getDirectories() {
return new ArrayList<>(directories);
}
+ /**
+ * Gets the EXIF directory in this output set.
+ *
+ * @return the EXIF directory, or null if no EXIF directory exists.
+ */
public TiffOutputDirectory getExifDirectory() {
return findDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_EXIF);
}
+ /**
+ * Gets the GPS directory in this output set.
+ *
+ * @return the GPS directory, or null if no GPS directory exists.
+ */
public TiffOutputDirectory getGpsDirectory() {
return findDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_GPS);
}
+ /**
+ * Gets the Interoperability directory in this output set.
+ *
+ * @return the Interoperability directory, or null if no Interoperability directory exists.
+ */
public TiffOutputDirectory getInteroperabilityDirectory() {
return findDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_INTEROPERABILITY);
}
+ /**
+ * Gets the EXIF directory in this output set, creating it if it doesn't exist.
+ *
+ * @return the EXIF directory.
+ * @throws ImagingException if it fails to create the directory.
+ */
public TiffOutputDirectory getOrCreateExifDirectory() throws ImagingException {
// EXIF directory requires root directory.
getOrCreateRootDirectory();
@@ -131,6 +224,12 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return addExifDirectory();
}
+ /**
+ * Gets the GPS directory in this output set, creating it if it doesn't exist.
+ *
+ * @return the GPS directory.
+ * @throws ImagingException if it fails to create the directory.
+ */
public TiffOutputDirectory getOrCreateGpsDirectory() throws ImagingException {
// GPS directory requires EXIF directory
getOrCreateExifDirectory();
@@ -142,6 +241,12 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return addGpsDirectory();
}
+ /**
+ * Gets the Root directory in this output set, creating it if it doesn't exist.
+ *
+ * @return the Root directory.
+ * @throws ImagingException if it fails to create the directory.
+ */
public TiffOutputDirectory getOrCreateRootDirectory() throws ImagingException {
final TiffOutputDirectory result = findDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_ROOT);
if (null != result) {
@@ -150,6 +255,13 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return addRootDirectory();
}
+ /**
+ * Gets all output items from all directories in this output set.
+ *
+ * @param outputSummary the output summary.
+ * @return the list of all output items.
+ * @throws ImagingException if an error occurs.
+ */
protected List<AbstractTiffOutputItem> getOutputItems(final TiffOutputSummary outputSummary) throws ImagingException {
final List<AbstractTiffOutputItem> result = new ArrayList<>();
@@ -160,10 +272,20 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return result;
}
+ /**
+ * Gets the Root directory in this output set.
+ *
+ * @return the Root directory.
+ */
public TiffOutputDirectory getRootDirectory() {
return findDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_ROOT);
}
+ /**
+ * Checks if this output set is empty (i.e., contains no directories).
+ *
+ * @return true if this output set is empty, false otherwise.
+ */
public boolean isEmpty() {
return directories.isEmpty();
}
@@ -173,12 +295,22 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return directories.iterator();
}
+ /**
+ * Removes a field with the specified tag from all directories in this output set.
+ *
+ * @param tag the tag of the field to remove.
+ */
public void removeField(final int tag) {
for (final TiffOutputDirectory directory : directories) {
directory.removeField(tag);
}
}
+ /**
+ * Removes a field with the specified tag info from all directories in this output set.
+ *
+ * @param tagInfo the tag info of the field to remove.
+ */
public void removeField(final TagInfo tagInfo) {
removeField(tagInfo.tag);
}
@@ -244,6 +376,12 @@ public final class TiffOutputSet implements Iterable<TiffOutputDirectory> {
return toString(null);
}
+ /**
+ * Gets a string representation with optional prefix.
+ *
+ * @param prefix the prefix, or null.
+ * @return the string representation.
+ */
public String toString(String prefix) {
if (prefix == null) {
prefix = "";
(commons-imaging) 05/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 9bc040474724ba8e6e279f7fcdaec84ea2bf4ea8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:02 2026 -0500
Javadoc
---
.../imaging/formats/jpeg/segments/UnknownSegment.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
index 06097378..7b25ea98 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
@@ -19,11 +19,29 @@ package org.apache.commons.imaging.formats.jpeg.segments;
import java.io.IOException;
import java.io.InputStream;
+/**
+ * Represents an unknown JPEG segment.
+ */
public class UnknownSegment extends AbstractGenericSegment {
+
+ /**
+ * Constructs a new unknown segment.
+ *
+ * @param marker the marker.
+ * @param bytes the segment data.
+ */
public UnknownSegment(final int marker, final byte[] bytes) {
super(marker, bytes);
}
+ /**
+ * Constructs a new unknown segment.
+ *
+ * @param marker the marker.
+ * @param markerLength the marker length.
+ * @param is the input stream.
+ * @throws IOException if an I/O error occurs.
+ */
public UnknownSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
super(marker, markerLength, is);
}
(commons-imaging) 06/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit deac78893e2af50eb4cc78f9ca94c4480bf8b2e8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:10:11 2026 -0500
Javadoc
---
.../png/transparencyfilters/TransparencyFilterGrayscale.java | 9 +++++++++
.../png/transparencyfilters/TransparencyFilterIndexedColor.java | 8 ++++++++
.../png/transparencyfilters/TransparencyFilterTrueColor.java | 9 +++++++++
3 files changed, 26 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
index f41257a9..9b33a141 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
@@ -23,9 +23,18 @@ import java.io.IOException;
import org.apache.commons.imaging.ImagingException;
+/**
+ * Transparency filter for grayscale PNG images.
+ */
public final class TransparencyFilterGrayscale extends AbstractTransparencyFilter {
private final int transparentColor;
+ /**
+ * Constructs a new transparency filter for grayscale images.
+ *
+ * @param bytes the transparency chunk data.
+ * @throws IOException if an I/O error occurs.
+ */
public TransparencyFilterGrayscale(final byte[] bytes) throws IOException {
super(bytes);
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterIndexedColor.java b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterIndexedColor.java
index ef21e3ef..7a70f150 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterIndexedColor.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterIndexedColor.java
@@ -20,8 +20,16 @@ import java.io.IOException;
import org.apache.commons.imaging.ImagingException;
+/**
+ * Transparency filter for indexed color PNG images.
+ */
public class TransparencyFilterIndexedColor extends AbstractTransparencyFilter {
+ /**
+ * Constructs a new transparency filter for indexed color images.
+ *
+ * @param bytes the transparency chunk data.
+ */
public TransparencyFilterIndexedColor(final byte[] bytes) {
super(bytes);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
index de531463..5e97732f 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
@@ -23,9 +23,18 @@ import java.io.IOException;
import org.apache.commons.imaging.ImagingException;
+/**
+ * Transparency filter for true color PNG images.
+ */
public final class TransparencyFilterTrueColor extends AbstractTransparencyFilter {
private final int transparentColor;
+ /**
+ * Constructs a new transparency filter for true color images.
+ *
+ * @param bytes the transparency chunk data.
+ * @throws IOException if an I/O error occurs.
+ */
public TransparencyFilterTrueColor(final byte[] bytes) throws IOException {
super(bytes);
(commons-imaging) 15/17: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit d306579078a3e8226380dd89ec95573da227e843
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:11:05 2026 -0500
Javadoc
---
.../java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index 29f43674..5bcd7721 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -51,8 +51,14 @@ import org.apache.commons.imaging.palette.PaletteFactory;
import org.apache.commons.imaging.palette.SimplePalette;
import org.apache.commons.lang3.StringUtils;
+/**
+ * Parser for X PixMap (XPM) image format.
+ */
public class XpmImageParser extends AbstractImageParser<XpmImagingParameters> {
+ /**
+ * XPM palette entry.
+ */
private static final class PaletteEntry {
int colorArgb;
int gray4LevelArgb;
(commons-imaging) 17/17: GH CI no longer needs to disable doclint
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 261b1e7b806c333c467d9d6ad71e3616013590bc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 5 14:43:14 2026 -0500
GH CI no longer needs to disable doclint
---
.github/workflows/maven.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 75c71431..486cef5f 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -54,4 +54,4 @@ jobs:
distribution: ${{ runner.os == 'macOS' && matrix.java == '8' && 'zulu' || 'temurin' }}
java-version: ${{ matrix.java }}
- name: Build with Maven
- run: mvn --errors --show-version --batch-mode --no-transfer-progress -Ddoclint=none -Darguments=-Xdoclint:none
+ run: mvn --errors --show-version --batch-mode --no-transfer-progress