Skip to content

Instantly share code, notes, and snippets.

@geekley
Last active January 6, 2022 01:52
Show Gist options
  • Save geekley/eead82bb191ff2fa8bdcf8dc2799193a to your computer and use it in GitHub Desktop.
Save geekley/eead82bb191ff2fa8bdcf8dc2799193a to your computer and use it in GitHub Desktop.
Convert images to a specified file format, like ico, png, etc., removing metadata. Uses ImageMagick's `mogrify` command. Add to `~/.local/share/applications/` on Ubuntu.
[Desktop Entry]
Name=Convert Image
GenericName=Image Converter
Comment=Convert images to a specified file format, like ico, png, etc.
Exec=bash -c 'x=$(zenity --title="Convert Images" --width=320 --entry --text="New file extension:" --entry-text=png) && mogrify -background transparent -strip -define icon:auto-resize=16,24,32,48,64,72,96,128,256 -format "$x" "$@"' "$0" %F
Icon=convert
Type=Application
Categories=Graphics;
StartupNotify=false
Terminal=false
TerminalOptions=\s--noclose
Keywords=Image;Transform;
MimeType=image/avs;image/bie;image/x-ms-bmp;image/cmyk;image/dcx;image/eps;image/fax;image/fits;image/gif;image/gray;image/jpeg;image/pjpeg;image/miff;image/mono;image/mtv;image/x-portable-bitmap;image/pcd;image/pcx;image/pdf;image/x-portable-graymap;image/pict;image/png;image/x-portable-anymap;image/x-portable-pixmap;image/ps;image/rad;image/x-rgb;image/rgba;image/rla;image/rle;image/sgi;image/sun-raster;image/targa;image/tiff;image/uyvy;image/vid;image/viff;image/x-xbitmap;image/x-xpixmap;image/x-xwindowdump;image/x-icon;image/yuv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment