public class ExifRewriter extends BinaryFileParser implements JpegConstants
See the source of the ExifMetadataUpdateExample class for example usage.
org.apache.sanselan.sampleUsage.WriteExifMetadataExample
Modifier and Type | Class and Description |
---|---|
static class |
ExifRewriter.ExifOverflowException |
debug
CONST_8BIM, EOI, EXIF_IDENTIFIER_CODE, icc_profile_label, JFIF0_SIGNATURE, JFIF0_SIGNATURE_ALTERNATIVE, JFIFMarker, JPEG_APP0, JPEG_APP0_Marker, JPEG_APP1_Marker, JPEG_APP13_Marker, JPEG_APP14_Marker, JPEG_APP15_Marker, JPEG_APP2_Marker, MARKERS, MAX_SEGMENT_SIZE, PHOTOSHOP_IDENTIFICATION_STRING, SOF0Marker, SOF10Marker, SOF11Marker, SOF12Marker, SOF13Marker, SOF14Marker, SOF15Marker, SOF1Marker, SOF2Marker, SOF3Marker, SOF4Marker, SOF5Marker, SOF6Marker, SOF7Marker, SOF8Marker, SOF9Marker, SOI, SOS_Marker, XMP_IDENTIFIER
BYTE_ORDER_BIG_ENDIAN, BYTE_ORDER_INTEL, BYTE_ORDER_LEAST_SIGNIFICANT_BYTE, BYTE_ORDER_LITTLE_ENDIAN, BYTE_ORDER_LSB, BYTE_ORDER_MOST_SIGNIFICANT_BYTE, BYTE_ORDER_MOTOROLA, BYTE_ORDER_MSB, BYTE_ORDER_NETWORK
Constructor and Description |
---|
ExifRewriter()
Constructor.
|
ExifRewriter(int byteOrder)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
removeExifMetadata(byte[] src,
OutputStream os)
Reads a Jpeg image, removes all EXIF metadata (by removing the APP1 segment),
and writes the result to a stream.
|
void |
removeExifMetadata(ByteSource byteSource,
OutputStream os)
Reads a Jpeg image, removes all EXIF metadata (by removing the APP1 segment),
and writes the result to a stream.
|
void |
removeExifMetadata(File src,
OutputStream os)
Reads a Jpeg image, removes all EXIF metadata (by removing the APP1 segment),
and writes the result to a stream.
|
void |
removeExifMetadata(InputStream src,
OutputStream os)
Reads a Jpeg image, removes all EXIF metadata (by removing the APP1 segment),
and writes the result to a stream.
|
void |
updateExifMetadataLossless(byte[] src,
OutputStream os,
TiffOutputSet outputSet)
Reads a Jpeg image, replaces the EXIF metadata and writes the result to a stream.
|
void |
updateExifMetadataLossless(ByteSource byteSource,
OutputStream os,
TiffOutputSet outputSet)
Reads a Jpeg image, replaces the EXIF metadata and writes the result to a stream.
|
void |
updateExifMetadataLossless(File src,
OutputStream os,
TiffOutputSet outputSet)
Reads a Jpeg image, replaces the EXIF metadata and writes the result to a stream.
|
void |
updateExifMetadataLossless(InputStream src,
OutputStream os,
TiffOutputSet outputSet)
Reads a Jpeg image, replaces the EXIF metadata and writes the result to a stream.
|
void |
updateExifMetadataLossy(byte[] src,
OutputStream os,
TiffOutputSet outputSet)
Reads a Jpeg image, replaces the EXIF metadata and writes the result to a stream.
|
void |
updateExifMetadataLossy(ByteSource byteSource,
OutputStream os,
TiffOutputSet outputSet)
Reads a Jpeg image, replaces the EXIF metadata and writes the result to a stream.
|
void |
updateExifMetadataLossy(File src,
OutputStream os,
TiffOutputSet outputSet)
Reads a Jpeg image, replaces the EXIF metadata and writes the result to a stream.
|
void |
updateExifMetadataLossy(InputStream src,
OutputStream os,
TiffOutputSet outputSet)
Reads a Jpeg image, replaces the EXIF metadata and writes the result to a stream.
|
byteArrayHasPrefix, convertByteArrayToInt, convertByteArrayToInt, convertByteArrayToShort, convertByteArrayToShort, getByteOrder, int2ToByteArray, read2Bytes, read3Bytes, read4Bytes, setByteOrder, setByteOrder
CharsToQuad, compareByteArrays, compareByteArrays, compareBytes, compareBytes, convertByteArrayToDouble, convertByteArrayToDouble, convertByteArrayToDoubleArray, convertByteArrayToFloat, convertByteArrayToFloat, convertByteArrayToFloatArray, convertByteArrayToInt, convertByteArrayToInt, convertByteArrayToIntArray, convertByteArrayToRational, convertByteArrayToRational, convertByteArrayToRationalArray, convertByteArrayToShort, convertByteArrayToShort, convertByteArrayToShortArray, convertDoubleArrayToByteArray, convertDoubleToByteArray, convertFloatArrayToByteArray, convertFloatToByteArray, convertIntArrayToByteArray, convertIntArrayToRationalArray, convertRationalArrayToByteArray, convertRationalToByteArray, convertShortArrayToByteArray, convertShortToByteArray, copyStreamToStream, debugByteArray, debugNumber, debugNumber, debugNumber, debugNumber, debugNumberArray, findNull, findNull, getBytearrayHead, getByteArrayTail, getDebug, getRAFBytes, getStreamBytes, head, int2ToByteArray, printByteBits, printCharQuad, printCharQuad, read2Bytes, read3Bytes, read4Bytes, readAndVerifyBytes, readAndVerifyBytes, readByte, readBytearray, readByteArray, readByteArray, readBytes, readRandomBytes, scanForByte, setDebug, skipBytes, skipBytes, slice, startsWith, tail, writeIntInToByteArray
public ExifRewriter()
public ExifRewriter(int byteOrder)
byteOrder
- byte order of EXIF segment. Optional. See BinaryConstants class.BinaryConstants
public void removeExifMetadata(File src, OutputStream os) throws ImageReadException, IOException, ImageWriteException
src
- Image file.os
- OutputStream to write the image to.ImageReadException
IOException
ImageWriteException
File
,
OutputStream
,
File
,
OutputStream
public void removeExifMetadata(byte[] src, OutputStream os) throws ImageReadException, IOException, ImageWriteException
src
- Byte array containing Jpeg image data.os
- OutputStream to write the image to.ImageReadException
IOException
ImageWriteException
public void removeExifMetadata(InputStream src, OutputStream os) throws ImageReadException, IOException, ImageWriteException
src
- InputStream containing Jpeg image data.os
- OutputStream to write the image to.ImageReadException
IOException
ImageWriteException
public void removeExifMetadata(ByteSource byteSource, OutputStream os) throws ImageReadException, IOException, ImageWriteException
byteSource
- ByteSource containing Jpeg image data.os
- OutputStream to write the image to.ImageReadException
IOException
ImageWriteException
public void updateExifMetadataLossless(File src, OutputStream os, TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException
Note that this uses the "Lossless" approach - in order to preserve data embedded in the EXIF segment that it can't parse (such as Maker Notes), this algorithm avoids overwriting any part of the original segment that it couldn't parse. This can cause the EXIF segment to grow with each update, which is a serious issue, since all EXIF data must fit in a single APP1 segment of the Jpeg image.
src
- Image file.os
- OutputStream to write the image to.outputSet
- TiffOutputSet containing the EXIF data to write.ImageReadException
IOException
ImageWriteException
public void updateExifMetadataLossless(byte[] src, OutputStream os, TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException
Note that this uses the "Lossless" approach - in order to preserve data embedded in the EXIF segment that it can't parse (such as Maker Notes), this algorithm avoids overwriting any part of the original segment that it couldn't parse. This can cause the EXIF segment to grow with each update, which is a serious issue, since all EXIF data must fit in a single APP1 segment of the Jpeg image.
src
- Byte array containing Jpeg image data.os
- OutputStream to write the image to.outputSet
- TiffOutputSet containing the EXIF data to write.ImageReadException
IOException
ImageWriteException
public void updateExifMetadataLossless(InputStream src, OutputStream os, TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException
Note that this uses the "Lossless" approach - in order to preserve data embedded in the EXIF segment that it can't parse (such as Maker Notes), this algorithm avoids overwriting any part of the original segment that it couldn't parse. This can cause the EXIF segment to grow with each update, which is a serious issue, since all EXIF data must fit in a single APP1 segment of the Jpeg image.
src
- InputStream containing Jpeg image data.os
- OutputStream to write the image to.outputSet
- TiffOutputSet containing the EXIF data to write.ImageReadException
IOException
ImageWriteException
public void updateExifMetadataLossless(ByteSource byteSource, OutputStream os, TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException
Note that this uses the "Lossless" approach - in order to preserve data embedded in the EXIF segment that it can't parse (such as Maker Notes), this algorithm avoids overwriting any part of the original segment that it couldn't parse. This can cause the EXIF segment to grow with each update, which is a serious issue, since all EXIF data must fit in a single APP1 segment of the Jpeg image.
byteSource
- ByteSource containing Jpeg image data.os
- OutputStream to write the image to.outputSet
- TiffOutputSet containing the EXIF data to write.ImageReadException
IOException
ImageWriteException
public void updateExifMetadataLossy(byte[] src, OutputStream os, TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException
Note that this uses the "Lossy" approach - the algorithm overwrites the entire EXIF segment, ignoring the possibility that it may be discarding data it couldn't parse (such as Maker Notes).
src
- Byte array containing Jpeg image data.os
- OutputStream to write the image to.outputSet
- TiffOutputSet containing the EXIF data to write.ImageReadException
IOException
ImageWriteException
public void updateExifMetadataLossy(InputStream src, OutputStream os, TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException
Note that this uses the "Lossy" approach - the algorithm overwrites the entire EXIF segment, ignoring the possibility that it may be discarding data it couldn't parse (such as Maker Notes).
src
- InputStream containing Jpeg image data.os
- OutputStream to write the image to.outputSet
- TiffOutputSet containing the EXIF data to write.ImageReadException
IOException
ImageWriteException
public void updateExifMetadataLossy(File src, OutputStream os, TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException
Note that this uses the "Lossy" approach - the algorithm overwrites the entire EXIF segment, ignoring the possibility that it may be discarding data it couldn't parse (such as Maker Notes).
src
- Image file.os
- OutputStream to write the image to.outputSet
- TiffOutputSet containing the EXIF data to write.ImageReadException
IOException
ImageWriteException
public void updateExifMetadataLossy(ByteSource byteSource, OutputStream os, TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException
Note that this uses the "Lossy" approach - the algorithm overwrites the entire EXIF segment, ignoring the possibility that it may be discarding data it couldn't parse (such as Maker Notes).
byteSource
- ByteSource containing Jpeg image data.os
- OutputStream to write the image to.outputSet
- TiffOutputSet containing the EXIF data to write.ImageReadException
IOException
ImageWriteException
Copyright © 2007-2012. All Rights Reserved.