Shrinking images and preserving exif only

Started by mattburns, January 11, 2012, 08:26:30 AM

Previous topic - Next topic

mattburns

I have a bunch of images that I've been sent from supporters of my project that are very useful for me as a test suite of images (corner cases etc.).

I'd like to shrink them and also blank out the image data (eg. to a simple white image). This way I can then store them in my open source repository for my test code.

It's important that the exif data is not corrupted in anyway, particularly the MakerNote section.
Is there a script or command that performs this same task to generate the sample images: https://exiftool.org/sample_images.html

Cheers,
Matt

Phil Harvey

#1
Hi Matt,

Attached is the Perl script I use to generate these files.  In the script I hard-coded "t/images/Writer.jpg" as the source image to replace the image in the file, so you will have to change this to suit your needs.

- Phil

Edit: I see that I posted an earlier version of this script here.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

mattburns

That's great Phil, very helpful as always, thanks!

-Matt

ps. for anyone else that might be reading this that uses the script, note that any exif data in the source image that clashes with exif data in the image you wish to update will end up in the new image.

Phil Harvey

Good point.  I should have mentioned that the source image (replacing "t/images/Writer.jpg") should be free of all metadata.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).