RSS Planet Python

Kushal Das: Thank you Gnome Nautilus scripts

The author resizes photos based on portrait or landscape mode before uploading them to various services. They used to resize all photos in a directory, but wanted to do it selectively. The author discovered that scripts can be used to resize photos selectively. Scripts can be written in any language and will receive selected files as command line arguments or environment variables. To add a script to the right-click menu, it needs to be placed in the ~/.local/share/nautilus/scripts/ directory. The author created a Python script to reduce image sizes, which is shared in the text. The script uses the PIL library to open images and the subprocess module to call the ImageMagick command-line tool. The script resizes landscape photos to 1024x686 and portrait photos to 686x1024. If an error occurs while processing an image, the script simply continues to the next one. The author demonstrates the script in action, selecting photos, right-clicking, and running the script to resize them.
kushaldas.in
kushaldas.in
Create attached notes ...