heinkunibert heinkunibert - 1 year ago 100
Java Question

How can I remove metadata from an image (JPG) without losing quality?

I already found this nearly similar question on Stackoverflow:

How can I remove metadata from a JPEG image in Java?

But when I use the Method described above, the saved image is being compressed. Is there any way to remove the metadata without compressing the image? Is there any library that I could use in my Java-Program?

Answer Source

Ok, I finaly found a solution by using Apache "commons-imaging":


    public void removeExifMetadata(final File jpegImageFile, final File dst)
        throws IOException, ImageReadException, ImageWriteException {
    OutputStream os = null;
    try {
        os = new FileOutputStream(dst);
        os = new BufferedOutputStream(os);

        new ExifRewriter().removeExifMetadata(jpegImageFile, os);
    } finally {
        if (os != null) {
            try {
            } catch (final IOException e) {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download