use of org.apache.commons.imaging.common.bytesource.ByteSourceFile in project commons-imaging by apache.
the class ExifRewriter method updateExifMetadataLossy.
/**
* Reads a Jpeg image, replaces the EXIF metadata and writes the result to a
* stream.
*
* <p>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).</p>
*
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
* @param outputSet
* TiffOutputSet containing the EXIF data to write.
* @throws ImageReadException if it fails to read the JFIF segments
* @throws IOException if it fails to read the image data
* @throws ImageWriteException if it fails to write the updated data
*/
public void updateExifMetadataLossy(final File src, final OutputStream os, final TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException {
final ByteSource byteSource = new ByteSourceFile(src);
updateExifMetadataLossy(byteSource, os, outputSet);
}
use of org.apache.commons.imaging.common.bytesource.ByteSourceFile in project commons-imaging by apache.
the class ExifRewriter method updateExifMetadataLossless.
/**
* Reads a Jpeg image, replaces the EXIF metadata and writes the result to a
* stream.
*
* <p>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.</p>
*
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
* @param outputSet
* TiffOutputSet containing the EXIF data to write.
* @throws ImageReadException if it fails to read the JFIF segments
* @throws IOException if it fails to read the image data
* @throws ImageWriteException if it fails to write the updated data
*/
public void updateExifMetadataLossless(final File src, final OutputStream os, final TiffOutputSet outputSet) throws ImageReadException, IOException, ImageWriteException {
final ByteSource byteSource = new ByteSourceFile(src);
updateExifMetadataLossless(byteSource, os, outputSet);
}
use of org.apache.commons.imaging.common.bytesource.ByteSourceFile in project commons-imaging by apache.
the class JpegXmpRewriter method updateXmpXml.
/**
* Reads a Jpeg image, replaces the XMP XML and writes the result to a
* stream.
*
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
* @param xmpXml
* String containing XMP XML.
* @throws ImageReadException if it fails to read the JFIF segments
* @throws IOException if it fails to read or write the data from the segments
* @throws ImageWriteException if it fails to write the JFIF segments
*/
public void updateXmpXml(final File src, final OutputStream os, final String xmpXml) throws ImageReadException, IOException, ImageWriteException {
final ByteSource byteSource = new ByteSourceFile(src);
updateXmpXml(byteSource, os, xmpXml);
}
use of org.apache.commons.imaging.common.bytesource.ByteSourceFile in project commons-imaging by apache.
the class JpegIptcRewriter method removeIPTC.
/**
* Reads a Jpeg image, removes all IPTC data from the App13 segment but
* leaves the other data in that segment (if present) unchanged (unless
* removeSegment is true) and writes the result to a stream.
* <p>
*
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
* @param removeSegment
* Remove the App13 segment.
*
* @see java.io.File
* @see java.io.OutputStream
* @throws ImageReadException if there are more than one Photoshop App13 segment, or if
* the Photoshop segment cannot be parsed
* @throws IOException if it fails to read from the origin byte source, or to write to the
* target byte source
* @throws ImageWriteException if it fails to write the target image
*/
public void removeIPTC(final File src, final OutputStream os, final boolean removeSegment) throws ImageReadException, IOException, ImageWriteException {
final ByteSource byteSource = new ByteSourceFile(src);
removeIPTC(byteSource, os, removeSegment);
}
use of org.apache.commons.imaging.common.bytesource.ByteSourceFile in project commons-imaging by apache.
the class JpegIptcRewriter method writeIPTC.
/**
* Reads a Jpeg image, replaces the IPTC data in the App13 segment but
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
*
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
* @param newData
* structure containing IPTC data.
* @throws ImageReadException if there are more than one Photoshop App13 segment, or if
* the Photoshop segment cannot be parsed
* @throws IOException if it fails to read from the origin byte source, or to write to the
* target byte source
* @throws ImageWriteException if it fails to write the target image
*/
public void writeIPTC(final File src, final OutputStream os, final PhotoshopApp13Data newData) throws ImageReadException, IOException, ImageWriteException {
final ByteSource byteSource = new ByteSourceFile(src);
writeIPTC(byteSource, os, newData);
}
Aggregations