Re: [guardian-dev] sanitizing PNGs

2018-03-30 Thread Hans-Christoph Steiner
Donno if you know about the JPEG Redaction lib from ObscuraCam. Its in C++, unfortunately, but might have useful approaches in it: https://github.com/guardianproject/ObscuraCam/tree/master/app/src/main/jni .hc Michael Rogers: > That doesn't look easy, unfortunately. The class seems to be

Re: [guardian-dev] sanitizing PNGs

2018-03-30 Thread Hans-Christoph Steiner
Sure, loading the whole thing in memory sounds better than dealing with the filesystem. The only problem I can there is if its used to process large images on small mobile devices. .hc Michael Rogers: > That doesn't look easy, unfortunately. The class seems to be designed to > work in three

Re: [guardian-dev] sanitizing PNGs

2018-03-29 Thread Michael Rogers
That doesn't look easy, unfortunately. The class seems to be designed to work in three stages: 1. Load the EXIF data from a file or input stream 2. Modify the EXIF data 3. Write the modified image to an output stream by reading the input a second time and replacing the EXIF segment We can't skip

Re: [guardian-dev] sanitizing PNGs

2018-03-28 Thread Hans-Christoph Steiner
Ah cool! It would be awesome to have the EXIF stripping work on a stream, rather than a file. .hc Michael Rogers: > Fantastic! > > The code is just a single file with minimal Android dependencies, so I > made a quick (untested) Java port: > > https://code.briarproject.org/akwizgran/metadata

Re: [guardian-dev] sanitizing PNGs

2018-03-28 Thread Michael Rogers
Fantastic! The code is just a single file with minimal Android dependencies, so I made a quick (untested) Java port: https://code.briarproject.org/akwizgran/metadata Cheers, Michael On 26/03/18 22:32, Hans-Christoph Steiner wrote: > > Turns out Google released an Android Support library that

Re: [guardian-dev] sanitizing PNGs

2018-03-26 Thread Hans-Christoph Steiner
Turns out Google released an Android Support library that makes it trivial to strip EXIF from JPEGs and some RAW formats: https://android-developers.googleblog.com/2016/12/introducing-the-exifinterface-support-library.html I found it via this app in F-Droid:

Re: [guardian-dev] sanitizing PNGs

2017-12-13 Thread Michael Rogers
Please feel free to use it, I place it in the public domain. I'll have a look at JPEGs next time I'm procrastinating. ;-) (By the way, after sending I noticed a bug: if the file ends with a truncated ancillary chunk, I think the cleaner will loop forever trying to skip to the end of the chunk.

Re: [guardian-dev] sanitizing PNGs

2017-12-13 Thread Hans-Christoph Steiner
That's awesome! Feeling inspired to also strip JPEGs? :-) I think they're easier. There is jhead, exiftool, and ObscuraCam's JNI code for examples. Can we use this under the GPLv3? .hc Michael Rogers: > Hi Hans-Christoph, > > I hacked this together based on the PNG specification, which >

Re: [guardian-dev] sanitizing PNGs

2017-12-13 Thread Michael Rogers
Hi Hans-Christoph, I hacked this together based on the PNG specification, which distinguishes between ancillary chunks that can be removed without affecting the image data, and critical chunks that can't. It's been tested on exactly two PNGs so far. :-)

Re: [guardian-dev] sanitizing PNGs

2017-12-12 Thread Rick Valenzuela
oh, you may already know this, but the previous code keeps a copy of the file and metadata. if you want it gone with no copies, you have to add a switch to overwrite, e.g.: ``` with exiftool.ExifTool() as et: et.execute(b'-all=', b'-overwrite_original', b'some.png') ``` On 12/12/2017 23:45,

Re: [guardian-dev] sanitizing PNGs

2017-12-12 Thread Rick Valenzuela
heh, nice -- I just found this: https://github.com/smarnach/pyexiftool Tried it out and it worked great: ``` with exiftool.ExifTool() as et: et.execute(b'-all=', b'some.png') ``` On 12/12/2017 19:53, Hans-Christoph Steiner wrote: > > Ah, cool, I thought exiftool only worked with JPEGs.

Re: [guardian-dev] sanitizing PNGs

2017-12-12 Thread Hans-Christoph Steiner
Ah, cool, I thought exiftool only worked with JPEGs. It seems to work with just about every image format. Now the open question is how to strip all PNG metadata with Python and Java. .hc Rick Valenzuela: > does exiftool do what you need? > > `exiftool -all= ` > > On 11/12/2017 17:57,

Re: [guardian-dev] sanitizing PNGs

2017-12-11 Thread Rick Valenzuela
does exiftool do what you need? `exiftool -all= ` On 11/12/2017 17:57, Hans-Christoph Steiner wrote: > > Anyone know any tools for sanitizing PNGs without touching the > compressed image data? With JPEG it is easy to strip out EXIF with > python-pil or many other tools. I haven't found a