It looks like you're new here. If you want to get involved, click one of these buttons!
[/spoiler]Exif metadata:
Root:
Image Description: 'JENOPTIK DIGITAL CAMERA'
Make: 'JENOPTIK OPTICAL CO,LTD'
Model: 'JD5200Z'
Orientation: 1
XResolution: 72
YResolution: 72
Resolution Unit: 2
Software: 'VJ305060'
Modify Date: '2006:08:16 11:56:11'
YCbCr Positioning: 2
Exif Offset: 254
Exif:
ISO: 100
Exif Version: 48, 50, 49, 48
Date Time Original: '2006:08:16 11:56:11'
Create Date: '2006:08:16 11:56:14'
Components Configuration: 1, 2, 3, 0
Compressed Bits Per Pixel: 1100/9830 (0,112)
Shutter Speed Value: 101/15 (6,733)
Aperture Value: 35055/10000 (3,506)
Exposure Compensation: 7/10 (0,7)
Subject Distance: Invalid rational (0/0)
Metering Mode: 2
Flash: 1
Focal Length: 21860/1000 (21,86)
Maker Note: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 50... (264)
Flashpix Version: 48, 49, 48, 48
Color Space: 1
Exif Image Width: 2560
Exif Image Length: 1920
Interop Offset: 840
Interoperability:
Interop Index: 'R98'
Interop Version: 48, 49, 48, 48
Sub: (jpegImageData)
Compression: 6
XResolution: 72
YResolution: 72
Resolution Unit: 2
Jpg From Raw Start: 964
Jpg From Raw Length: 12117
Photoshop (IPTC) metadata:
Keywords: SampleKeyword
[/spoiler]All EXIF data successfully removed from B:\Sonstiges\test.jpg
Result saved in B:\Sonstiges\temp.jpg
[/spoiler]created file B:\Sonstiges\temp\100_1788.JPG
created file B:\Sonstiges\temp\100_1789.JPG
created file B:\Sonstiges\temp\100_1790.JPG
created file B:\Sonstiges\temp\100_1791.JPG
created file B:\Sonstiges\temp\100_1792.JPG
created file B:\Sonstiges\temp\100_1793.JPG
created file B:\Sonstiges\temp\100_1796.JPG
created file B:\Sonstiges\temp\100_1797.JPG
created file B:\Sonstiges\temp\100_1799.JPG
created file B:\Sonstiges\temp\100_1800.JPG
created file B:\Sonstiges\temp\100_1801.JPG
created file B:\Sonstiges\temp\100_1802.JPG
created file B:\Sonstiges\temp\100_1939.JPG
Unable to remove EXIF data from B:\Sonstiges\Thumbs.db
import java.io.File;
import java.io.IOException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.ImageWriteException;
import exifremover.exifremover.model.EXIFRemover;
/**
* Command line interface for exifremover.
*
* @author deque
*
*/
public class CLI {
private static final String TEMP_DIR = \"temp\";
private static final String VERSION = \"EXIFRemover 0.1\";
private static final String USAGE = \"exifremover -d <filename/folder>\"
+ \" [-dest <filename/folder>]\";
private static final String FILE_SEPARATOR = System
.getProperty(\"file.separator\");
public static void main(String[] args) {
new CLI(args);
}
/**
* Initializes options, invokes parsing of command line arguments.
*
* @param args
* the command line arguments
*/
public CLI(String[] args) {
Options options = initOptions();
parseCommandLine(args, options);
}
/**
* Parses arguments for available options.
*
* @param args
* the command line arguments
* @param options
* the command line options for which the arguments are parsed
*/
private void parseCommandLine(String[] args, Options options) {
CommandLineParser parser = new PosixParser();
try {
CommandLine line = parser.parse(options, args);
if (line.hasOption(\"version\")) {
System.out.println(VERSION);
}
if (line.hasOption(\"help\") || args.length == 0) {
showHelp(options);
}
if (line.hasOption(\"show-exif\")) {
showExif(line);
}
if (line.hasOption(\"delete-exif\")) {
deleteEXIF(line);
}
} catch (ParseException e) {
System.err.println(e.getMessage());
} catch (ImageWriteException e) {
System.err.println(e.getMessage());
} catch (IOException e) {
System.err.println(e.getMessage());
} catch (ImageReadException e) {
System.err.println(e.getMessage());
}
}
/**
* Prints out all EXIF data found in given file.
*
* @param line
* command line that contains the image path
* @throws IOException
* @throws ImageReadException
*/
private void showExif(CommandLine line) throws IOException,
ImageReadException {
File file = new File(line.getOptionValue(\"show-exif\"));
EXIFRemover remover = new EXIFRemover(file);
System.out.println(remover.getExifData());
}
/**
* Prints out help information like usage and available options.
*
* @param options
* command line options to be shown
*/
private void showHelp(Options options) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp(USAGE, options);
}
/**
* Removes EXIF data from a single image file or all image files in a folder
* given as command line argument.
*
* If a folder is given, it saves the resulting images into destination
* folder. A TEMP_DIR is created if no destination is given (this is mainly
* for security reasons, so you are not able to overwrite a whole folder of
* images by mistake).
*
* If a single image file is given, it saves the resulting image into a
* given destination. If there is no destination, the image file is
* overwritten, which means EXIF data of the original file is lost unless
* you have a copy.
*
* @param line
* command line that contains the paths for source and maybe
* destination
* @throws IOException
* @throws ImageReadException
* @throws ImageWriteException
*/
private void deleteEXIF(CommandLine line) throws IOException,
ImageReadException, ImageWriteException {
File source = new File(line.getOptionValue(\"delete-exif\"));
// if no destination folder given, assign source folder to dest
File dest = line.hasOption(\"dest\") ? new File(
line.getOptionValue(\"dest\")) : source;
if (source.isDirectory()) {
deleteEXIFFromDir(source, dest);
} else {
deleteEXIFForSingleFile(source, dest);
}
}
/**
* Removes EXIF data from all files in a given source directory and saves
* new images into the destination directory. Destination directory is
* created if it doesn't exist.
*
* @param source
* source folder that contains the image files
* @param dest
* destination folder where the new images are saved to
*/
private void deleteEXIFFromDir(File source, File dest) {
assert source.isDirectory();
if (!dest.isDirectory()) {
if (dest.exists()) {
System.err.println(\"destination file is no directory\");
return;
} else {
dest.mkdir();
}
}
// create temp folder if destination folder equals source folder
if (dest.equals(source)) {
removeAllEXIFFromFolder(source, new File(dest.getAbsolutePath()
+ FILE_SEPARATOR + TEMP_DIR));
} else {
removeAllEXIFFromFolder(source, dest);
}
}
/**
* Removes EXIF data from a single image file which is the source file.
* Resulting images is saved into the destination file which may be the same
* as the source file (in that case the image is overwritten).
*
* @param source
* source folder that contains the image files
* @param dest
* destination folder where the new images are saved to
* @throws IOException
* @throws ImageReadException
* @throws ImageWriteException
*/
private void deleteEXIFForSingleFile(File source, File dest)
throws IOException, ImageReadException, ImageWriteException {
EXIFRemover remover = new EXIFRemover(source);
remover.removeEXIFData(dest);
System.out.println(\"All EXIF data successfully removed from \"
+ source.getAbsolutePath());
System.out.println(\"Result saved in \" + dest.getAbsolutePath());
}
/**
* Deletes EXIF information from every file in a given source folder.
* Resulting images are saved the destination folder. The given arguments
* files must be directories.
*
* Directories within the source folder are ignored. Everything else will be
* treated as an image.
*
* @param srcFolder
* source folder that contains the image files
* @param destFolder
* destination folder where the new images are saved to
*/
private void removeAllEXIFFromFolder(File srcFolder, File destFolder) {
assert srcFolder.isDirectory() && destFolder.isDirectory();
File[] files = srcFolder.listFiles();
if (!destFolder.exists()) {
destFolder.mkdir();
}
for (File file : files) {
if (file.isFile()) { // make sure that file is no directory
try {
EXIFRemover remover = new EXIFRemover(file);
File destFile = new File(destFolder.getAbsolutePath()
+ FILE_SEPARATOR + file.getName());
remover.removeEXIFData(destFile);
System.out.println(\"created file \"
+ destFile.getAbsolutePath());
} catch (IOException e) {
System.err.println(\"Can not convert or read file \"
+ file.getAbsolutePath());
} catch (ImageReadException e) {
System.err.println(\"Unable to remove EXIF data from \"
+ file.getAbsolutePath());
} catch (ImageWriteException e) {
System.err.println(\"Unable to remove EXIF data from \"
+ file.getAbsolutePath());
}
}
}
}
/**
* Initializes command line options like d, s, dest, help.
*
* @return initialized options
*/
private Options initOptions() {
Options options = new Options();
options.addOption(\"v\", \"version\", false, \"show version\");
options.addOption(\"h\", \"help\", false, \"print help message\");
options.addOption(\"s\", \"show-exif\", true, \"show exif data\");
options.getOption(\"s\").setArgName(\"filename\");
options.addOption(\"d\", \"delete-exif\", true,
\"delete all exif data of given file(s)\");
options.getOption(\"d\").setArgName(\"filename\");
options.addOption(\"dest\", true, \"save changed image(s) into file\");
options.getOption(\"dest\").setArgName(\"filename\");
return options;
}
}
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
/**
* A helper class for file input and output.
*
* @author deque
*
*/
public class FileIO {
/**
* @param file
* file to get the bytes from
* @return byte array that represents the given file
* @throws IOException
*/
public static byte[] getBytesFromFile(File file) throws IOException {
byte[] data = null;
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(file);
data = new byte[(int) file.length()];
fileInputStream.read(data);
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return data;
}
}
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.ImageWriteException;
import org.apache.sanselan.Sanselan;
import org.apache.sanselan.common.IImageMetadata;
import org.apache.sanselan.formats.jpeg.exifRewrite.ExifRewriter;
import exifremover.exifremover.FileIO;
/**
* A class that utilizes the sanselan library to show or remove EXIF data
*
* @author deque
*
*/
public class EXIFRemover {
private final File image;
private final byte[] imageBytes;
/**
* Constructor. Retrieves image bytes from given image file.
*
* @param image
* file that shall be treated
* @throws IOException
*/
public EXIFRemover(File image) throws IOException {
this.image = image;
imageBytes = FileIO.getBytesFromFile(image);
}
/**
* @return String that describes the meta data of the given image file.
* @throws ImageReadException
* @throws IOException
*/
public String getExifData() throws ImageReadException, IOException {
IImageMetadata metdata = Sanselan.getMetadata(imageBytes);
return metdata.toString();
}
/**
* @return image file
*/
public File getImageFile() {
return image;
}
/**
* Completely deletes EXIF data from the extracted image bytes. Saves the
* resulting images bytes into the destination file.
*
* @param dest
* the destination file
* @throws ImageReadException
* @throws ImageWriteException
* @throws IOException
*/
public void removeEXIFData(File dest) throws ImageReadException,
ImageWriteException, IOException {
OutputStream os = null;
try {
os = new FileOutputStream(dest);
ExifRewriter exifWriter = new ExifRewriter();
exifWriter.removeExifMetadata(imageBytes, os);
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
[/spoiler]Copyright 2012 Deque at http://iexploit.org All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY Deque at http://iexploit.org ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Deque at http://iexploit.org OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the
authors and should not be interpreted as representing official policies, either expressed
or implied, of Deque at http://iexploit.org
Does EXIF data include geo-tagging info? That would be awesome if you came up with a geo-tag remover.
java -jar exifremover.jar -s img_5546.jpg
Exif metadata:
Root:
Make: 'Canon'
Model: 'Canon EOS 400D DIGITAL'
XResolution: 300
YResolution: 300
Resolution Unit: 2
Modify Date: '2008:08:05 23:48:04'
Artist: 'unknown'
Copyright: 'Eirik Solheim - www.eirikso.com'
Exif Offset: 240
GPSInfo: 610
Exif:
Exposure Time: 1/100 (0.01)
FNumber: 22/10 (2.2)
Exposure Program: 2
ISO: 400
Exif Version: 48, 50, 50, 49
Date Time Original: '2008:08:05 20:59:32'
Create Date: '2008:08:05 20:59:32'
Shutter Speed Value: 6643856/1000000 (6.644)
Aperture Value: 2275007/1000000 (2.275)
Exposure Compensation: 0
Max Aperture Value: 96875/100000 (0.969)
Metering Mode: 1
Flash: 16
Focal Length: 50
Focal Plane XResolution: 3888000/877 (4,433.295)
Focal Plane YResolution: 2592000/582 (4,453.608)
Focal Plane Resolution Unit: 2
Custom Rendered: 0
Exposure Mode: 0
White Balance: 0
Scene Capture Type: 0
Gps:
Interop Index: 'N'
Interop Version: 59, 55, 37417/1285 (29.118)
Unknown Tag (0x3): 'E'
Unknown Tag (0x4): 10, 41, 55324/1253 (44.153)
Unknown Tag (0x5): 0
Unknown Tag (0x6): 81
Photoshop (IPTC) metadata:
Keywords: Marienlyst
Keywords: Norway
Keywords: 1.71 Km to Marienlyst in Norway
Keywords: geotagged
Keywords: geo:lat=59.924755
Keywords: geo:lon=10.695598
By-line: unknown
Copyright Notice: Eirik Solheim - www.eirikso.com
[deque@desolate ~]$ java -jar exifremover.jar -d img_5546.jpg -dest img-deleted.jpg
All EXIF data successfully removed from /home/deque/img_5546.jpg
Result saved in /home/deque/img-deleted.jpg
[deque@desolate ~]$ java -jar exifremover.jar -s img-deleted.jpg
No Exif metadata.
Photoshop (IPTC) metadata:
Keywords: Marienlyst
Keywords: Norway
Keywords: 1.71 Km to Marienlyst in Norway
Keywords: geotagged
Keywords: geo:lat=59.924755
Keywords: geo:lon=10.695598
By-line: unknown
Copyright Notice: Eirik Solheim - www.eirikso.com
Also have you done any android dev?