Resizing images while keeping exif metadata
note: currently requires a Python installation
Often I won't need the entire 8MB full-resolution photos I take on my digital camera. If I use common image software to resize the photo to make it 50% smaller, though, all of the exif metadata is lost, like the original filename and camera/lens settings.
Here is how to use labs_coordinate_pictures to resize images while keeping exif metadata,
From the Pictures menu, choose 'Resize images keeping exifs..'
Click 'Browse...', choose the directory containing the unorganized images and click OK.
I can now use the arrow keys to move from image to image.
For each image, I'll either press Delete to delete, or mark the size that I want to move to. Shift+0 to keep the full-resolution image, press Shift+9 to resize to ~60%, Shift+7 to resize to ~50%, Shift+1 to resize to ~25%, and so on.
(Shift+9 will assign the size 1728, as seen on the left of the screen. This means means to resize down so that the shortest dimension is 1728pixels, preserving aspect ratio. My camera has a resolution of 4032x3024 pixels, so the output image will be resized to 1728÷3024 or ~57%. I chose these presets to ensure that the output image will have dimensions that are multiples of 16, which can be useful for later cropping and rotating, you can edit the presets and keyboard shortcuts by choosing Edit Categories... from the Categories menu.)
I can undo deleting or marking an image by pressing Ctrl+Z.
Once I've marked all of the images, I'll see this:
- Now I'll close labs_coordinate_pictures and open
tools/ben_python_img/img_resize_keep_exif.pyin a code editor and scroll down to the end:
- I'll type in the path to the directory with my images, and uncomment the last two lines:
- I'll then save and run this script, which will resize the images and ask a few simple questions along the way. Cleanup() will look for newly resized images and remove the full-resolution originals.
If you see an error like
ModuleNotFoundError: No module named 'PIL', install the pillow module by running
pip install pillowin a console
If jpgHighQualityChromaSampling is set to true, jpg files will contain better sharpness, especially for details like red text
Original filenames will be saved into the EXIF field 'Copyright'
Output jpg quality is set to 94 by default
The EXIF fields that will be saved include: