├── .gitignore ├── Mac OS X Resize 1280.dmg ├── resize-1280.py ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | -------------------------------------------------------------------------------- /Mac OS X Resize 1280.dmg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raster/Resize-1280/master/Mac OS X Resize 1280.dmg -------------------------------------------------------------------------------- /resize-1280.py: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/python3 2 | # 3 | # Pete Prodoehl 4 | # 5 | # Resizes images to 1280x960 6 | # Assuming 4032x3024 images as source 7 | # (Which is the size of photos from my phone...) 8 | # 9 | 10 | from PIL import Image 11 | import glob 12 | import getopt 13 | import sys 14 | import os 15 | 16 | # read command line arguments first 17 | fullCmdArguments = sys.argv 18 | 19 | # then read further arguments 20 | argumentList = fullCmdArguments[1:] 21 | 22 | # loop through files, resizing each one 23 | for infile in argumentList: 24 | file, ext = os.path.splitext(infile) 25 | img = Image.open(infile) 26 | newimg = img.resize((1280, 960)) 27 | newimg.convert('RGB').save(file + ".jpg","JPEG",Optimize=True) 28 | 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Resize 1280 2 | 3 | This is a python3 script which resizes images to 1280x960. 4 | 5 | It solves a specific problem I have where I often want smaller images 6 | to send via email and files that are 4032x3024 are just too large for 7 | my needs. (I like to preserve disk space & bandwidth.) 8 | 9 | Note: The script will overwrite the original image after scaling it down. 10 | 11 | I've included a Mac OS application created using DropScript, which 12 | will only be useful for people with Python3 and the Pillow library 13 | installed, who are also running Mac OS X. You are both welcome. 14 | 15 | I've read about py2exe and py2app but haven't used them yet... 16 | I'll dig into them when I have time. 17 | 18 | You can read more about this here: 19 | 20 | http://rasterweb.net/raster/2019/02/06/python-image-resizing/ 21 | 22 | --- 23 | 24 | Pete Prodoehl 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Pete Prodoehl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------