Warning: Here, there be noobs.
So, I'm in way over my head with the EXIF library at http://www.drewnoakes.com/code/exif/
I'm trying to pull the thumbnails embedded in the EXIFs of my JPEGs. Ideally, I would be loading them straight from the file, but I've settled on writing them directly to a tiny temporary BMP, which I can reload, because the smattering of examples I can find do just that, and no more.
I'm pretty sure I need to do this:
Code:ExifDirectory directory = (ExifDirectory)metadata.getDirectory(ExifDirectory.class);
But every time it reaches that line, it dies and says:
Invalid type: 70
Syntax error: ")" inserted to complete Arguments
I have no idea what that means. Other people have apparently run this line successfully... it seems to have the correct number of parenthesis everywhere... it gives the same error if I just plop "ExifDirectory.class" on a line all by itself.
In case it's relevent, here's the whole shebang. It's pointless, uncommented, and verbose at the moment, because I'm still at the 'cobbling things together' stage.
Code:String[] picFiles = new String[0];
Metadata[] picData = new Metadata[0];
File picFolder = processing.app.Base.selectFolder("Pick a folder:",new File((String)""),new Frame(""));
String[] allFiles = processing.app.Base.listFiles(picFolder,false);
for (int x = 0; x < allFiles.length; x++){
if((allFiles[x].substring(allFiles[x].length()-4,allFiles[x].length())).equals(".JPG")){
picFiles = append(picFiles,allFiles[x]);
println(picFiles[picFiles.length-1]);
}
}
for (int x = 0; x < picFiles.length; x++){
try{
picData = (Metadata[])append(picData,JpegMetadataReader.readMetadata(new File(picFiles[x])));
println(str(picData.length));}
catch(com.drew.imaging.jpeg.JpegProcessingException message){println("Something bad has happened.");}
}
for (int x = 0; x < picData.length; x++){
try{
ExifDirectory directory = (ExifDirectory)picData[x].getDirectory(ExifDirectory.class);
directory.writeThumbnail("../../pics/1/thumb.bmp");
}catch(Exception message){println("Something bad has happened.");}
}