News for hackers. Stuff that matters.
Re:File Format Posters by nradov on Friday April 07, 2017 @06:25PM (#14063958)
If only that were true. Yet as far as I can determine there is no available Java library which allows for full reading and writing of the JPEG/EXIF file format. There are a number of Java libraries which allow for reading and encoding JPEG image data but none of them offer complete support for the metadata.

The JPEG/EXIF format itself is a mess, just a completely horrible design. It's one of those old-school file formats like MS Word .doc which isn't so much of a "format" as modern programmers commonly understand the term but more like a straight dump of memory chunks into a file. That's not so bad if you're programming in C but surprisingly difficult in higher-level safe languages like Java.

Re:File Format Posters by cvwright on Friday April 07, 2017 @09:59PM (#14064836)
It was surprising to me how few unique implementations there are of JPEG at all. Dig deep enough into most open source image libraries for almost any language, and eventually you'll find IJG libjpeg or one of its descendants.
Re:File Format Posters by alexott on Friday April 07, 2017 @06:30PM (#14063985)
For metadata, did you check Tika?
Re:File Format Posters by nradov on Friday April 07, 2017 @11:08PM (#14065074)
I tried that but it's pretty buggy. Writing some metadata just fails silently with no indication of what went wrong.
Re:File Format Posters by CyberDildonics on Friday April 07, 2017 @07:53PM (#14064369)
It isn't a format's fault if a language can't manipulate memory properly.
Re:File Format Posters by nradov on Friday April 07, 2017 @11:02PM (#14065057)
I think you missed the point. First, we should have learned by now that using an unsafe language like C to read data from an untrusted source directly into memory is really stupid. Just look at the security vulnerabilities that have been found in applications like ImageMagick.

Second, the JPEG/EXIF format is just needlessly complex regardless of language. Instead of marking metadata locations using something sensible like delimiters it's essentially a whole file system within the file with directories and directory entries. The values of some directory entries aren't storied there directly but instead pointed to by a byte offset value. So if you want to insert another entry you have to recalculate all the offsets! Even using C it's easy to screw that up and corrupt the whole file.