public class JPGTweaker
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
extractDepthMap(java.io.InputStream is,
java.lang.String pathToDepthMap) |
static byte[] |
extractICCProfile(java.io.InputStream is) |
static void |
extractICCProfile(java.io.InputStream is,
java.lang.String pathToICCProfile) |
static java.awt.image.BufferedImage |
extractThumbnail(java.io.InputStream is)
Extracts a single thumbnail image from JFIF/APP0, Exif APP1 and/or Adobe APP13 segment if any.
|
static java.util.Collection<java.awt.image.BufferedImage> |
extractThumbnails(java.io.InputStream is)
Extracts thumbnail images from JFIF/APP0, Exif APP1 and/or Adobe APP13 segment if any.
|
static void |
extractThumbnails(java.io.InputStream is,
java.lang.String pathToThumbnail)
Extracts thumbnail images from JFIF/APP0, Exif APP1 and/or Adobe APP13 segment if any.
|
static ICCProfile |
getICCProfile(java.io.InputStream is) |
static void |
insertComments(java.io.InputStream is,
java.io.OutputStream os,
java.util.List<java.lang.String> comments) |
static void |
insertExif(java.io.InputStream is,
java.io.OutputStream os,
Exif exif,
boolean update) |
static void |
insertICCProfile(java.io.InputStream is,
java.io.OutputStream os,
byte[] data)
Insert ICC_Profile as one or more APP2 segments
|
static void |
insertICCProfile(java.io.InputStream is,
java.io.OutputStream os,
java.awt.color.ICC_Profile icc_profile) |
static void |
insertICCProfile(java.io.InputStream is,
java.io.OutputStream os,
ICCProfile icc_profile) |
static void |
insertIPTC(java.io.InputStream is,
java.io.OutputStream os,
java.util.Collection<IPTCDataSet> iptcs,
boolean update)
Inserts a list of IPTCDataSet into a JPEG APP13 Photoshop IRB segment
|
static void |
insertIRB(java.io.InputStream is,
java.io.OutputStream os,
java.util.Collection<_8BIM> bims,
boolean update)
Inserts a collection of _8BIM into a JPEG APP13 Photoshop IRB segment
|
static void |
insertIRBThumbnail(java.io.InputStream is,
java.io.OutputStream os,
java.awt.image.BufferedImage thumbnail) |
static void |
insertMetadata(java.util.Collection<Metadata> metadata,
java.io.InputStream is,
java.io.OutputStream os)
Insert a collection of Metadata into an image
|
static void |
insertXMP(java.io.InputStream is,
java.io.OutputStream os,
java.lang.String xmp,
java.lang.String extendedXmp)
Insert XMP into single APP1 or multiple segments.
|
static void |
insertXMP(java.io.InputStream is,
java.io.OutputStream os,
XMP jpegXmp)
Insert a XMP instance into the image.
|
static java.util.Map<MetadataType,Metadata> |
readMetadata(java.io.InputStream is)
Reads metadata from the input image stream.
|
static void |
removeAPPn(Marker APPn,
java.io.InputStream is,
java.io.OutputStream os) |
static java.util.Map<MetadataType,Metadata> |
removeMetadata(java.io.InputStream is,
java.io.OutputStream os,
MetadataType... metadataTypes)
Removes metadata specified by the input MetadataType set.
|
static java.util.Map<MetadataType,Metadata> |
removeMetadata(java.util.Set<MetadataType> metadataTypes,
java.io.InputStream is,
java.io.OutputStream os)
Removes metadata specified by the input MetadataType set.
|
public static byte[] extractICCProfile(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static void extractICCProfile(java.io.InputStream is, java.lang.String pathToICCProfile) throws java.io.IOException
java.io.IOException
public static void extractDepthMap(java.io.InputStream is, java.lang.String pathToDepthMap) throws java.io.IOException
java.io.IOException
public static java.awt.image.BufferedImage extractThumbnail(java.io.InputStream is) throws java.io.IOException
is
- InputStream for the JPEG image.java.io.IOException
public static java.util.Collection<java.awt.image.BufferedImage> extractThumbnails(java.io.InputStream is) throws java.io.IOException
is
- InputStream for the JPEG image.java.io.IOException
public static void extractThumbnails(java.io.InputStream is, java.lang.String pathToThumbnail) throws java.io.IOException
is
- InputStream for the JPEG image.pathToThumbnail
- a path or a path and name prefix combination for the extracted thumbnails.java.io.IOException
public static ICCProfile getICCProfile(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static void insertComments(java.io.InputStream is, java.io.OutputStream os, java.util.List<java.lang.String> comments) throws java.io.IOException
java.io.IOException
public static void insertExif(java.io.InputStream is, java.io.OutputStream os, Exif exif, boolean update) throws java.io.IOException
is
- input image streamos
- output image streamexif
- Exif instanceupdate
- True to keep the original data, otherwise falsejava.lang.Exception
java.io.IOException
public static void insertICCProfile(java.io.InputStream is, java.io.OutputStream os, byte[] data) throws java.io.IOException
is
- input stream for the original imageos
- output stream to write the ICC_Profiledata
- ICC_Profile data array to be insertedjava.io.IOException
public static void insertICCProfile(java.io.InputStream is, java.io.OutputStream os, java.awt.color.ICC_Profile icc_profile) throws java.io.IOException
java.io.IOException
public static void insertICCProfile(java.io.InputStream is, java.io.OutputStream os, ICCProfile icc_profile) throws java.lang.Exception
java.lang.Exception
public static void insertIPTC(java.io.InputStream is, java.io.OutputStream os, java.util.Collection<IPTCDataSet> iptcs, boolean update) throws java.io.IOException
is
- InputStream for the original imageos
- OutputStream for the image with IPTC insertediptcs
- a collection of IPTCDataSet to be insertedupdate
- boolean if true, keep the original IPTC data; otherwise, replace it completely with the new IPTC datajava.io.IOException
public static void insertIRB(java.io.InputStream is, java.io.OutputStream os, java.util.Collection<_8BIM> bims, boolean update) throws java.io.IOException
is
- InputStream for the original imageos
- OutputStream for the image with _8BIMs insertedbims
- a collection of _8BIM to be insertedupdate
- boolean if true, keep the other _8BIMs; otherwise, replace the whole IRB with the inserted _8BIMsjava.io.IOException
public static void insertIRBThumbnail(java.io.InputStream is, java.io.OutputStream os, java.awt.image.BufferedImage thumbnail) throws java.io.IOException
java.io.IOException
public static void insertMetadata(java.util.Collection<Metadata> metadata, java.io.InputStream is, java.io.OutputStream os) throws java.io.IOException
metadata
- a collection of Metadata to be insertedis
- InputStream for the imageos
- OutputStream for the image with Metadata insertedjava.io.IOException
public static void insertXMP(java.io.InputStream is, java.io.OutputStream os, XMP jpegXmp) throws java.io.IOException
The XMP instance can be created either by passing both standard and extended XMP or simply by passing a single standard XMP. If the serialized standard XMP size exceeds the size of one APP1 segment, it will be split into a standard part and an extended part automatically. This process is transparent to the user and is the preferred way of inserting XMP into JPEG images.
is
- InputStream for the image.os
- OutputStream for the image.jpegXmp
- XMP instancejava.io.IOException
JpegXMP
public static void insertXMP(java.io.InputStream is, java.io.OutputStream os, java.lang.String xmp, java.lang.String extendedXmp) throws java.io.IOException
When converted to bytes, the XMP part should be able to fit into one APP1.
is
- InputStream for the image.os
- OutputStream for the image.xmp
- XML string for the XMP - Assuming in UTF-8 format.extendedXmp
- XML string for the extended XMP - Assuming in UTF-8 formatjava.io.IOException
public static java.util.Map<MetadataType,Metadata> readMetadata(java.io.InputStream is) throws java.io.IOException
is
- InputStream for the image.java.io.IOException
public static void removeAPPn(Marker APPn, java.io.InputStream is, java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public static java.util.Map<MetadataType,Metadata> removeMetadata(java.io.InputStream is, java.io.OutputStream os, MetadataType... metadataTypes) throws java.io.IOException
metadataTypes
- a set containing all the MetadataTypes to be removed.is
- InputStream for the original image.os
- OutputStream for the image with metadata removed.java.io.IOException
public static java.util.Map<MetadataType,Metadata> removeMetadata(java.util.Set<MetadataType> metadataTypes, java.io.InputStream is, java.io.OutputStream os) throws java.io.IOException
metadataTypes
- a set containing all the MetadataTypes to be removed.is
- InputStream for the original image.os
- OutputStream for the image with metadata removed.java.io.IOException