I know in the command line in linux i can use image magick to quickly brighten an image

convert nebula.landscape.jpg -brightness-contrast 30 bright.jpg

im trying to create a function in emacs (dired?) to launch this command on an image and create a copy of that image (after the brightness command is run). I know one can use ! but i want it to be persistant over sessions and thus i thought of a function. The copy would have the .bright suffix added such as image.bright.jpg. can anyone help with an example.

if there are other internal emacs methods to do this i would be happy to use this as well. Also, if one couls save a list of commonly used commands used in ! and maybe use ivy/helm to choose them that also could work great.

  • Did you try ! (dired-do-shell-command) followed by your command line? – Drew Oct 28 '17 at 19:40
  • thx drew. sorry i should have mentioned im looking for a funtion to do so. alternitavly, is there a way perhaps to bring up a list of user defined most used command for !? ill update the question – zeltak Oct 29 '17 at 4:34
  • You can use a combination of dired-get-file-for-visit, start-process, set-process-sentinel. Adding things like ivy/helm to your question breaks the tradition of one question per thread, and reduces the likelihood that an answer will be forthcoming for a variety of reasons. I've written a few answers over the years that demonstrate how to launch function and/or new procesess after a previous process finishes successfully, and they are available by Googling things like: emacs start-process set-process-sentinel – lawlist Oct 29 '17 at 6:39
  • If you want your own, dired-do-shell-command-like command that runs only one dedicated command, then write a command that passes the shell command string to dired-do-shell-command (use dired-get-marked-files in the interactive spec - see the dired-do-shell-command code). If you want to associate given shell commands with given file-name patterns, customize option dired-guess-shell-alist-user (from dired-x.el). – Drew Oct 29 '17 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.