How to set the compression of images from the context menu of linux mint?

Hello! I can not understand c problem in Linux Mint file Manager Caja supports the scripts in the folder ~/.config/caja/scripts directory, there are placed the following script, which needs to compress the image with loss of quality:
#!/bin/sh
file=$CAJA_SCRIPT_SELECTED_URIS
jpegoptim -m40 $file
zenity --info --text="the compression of the photo is successfully completed!"
fi


But I can not understand why the team jpegoptim -m40 $file doesn't work please help me
July 8th 19 at 15:22
1 answer
July 8th 19 at 15:24
Solution
In General, he found the solution:
#!/bin/sh
IFS="
"
f=$CAJA_SCRIPT_SELECTED_FILE_PATHS
for i in $f;
do
convert "$i" -quality 20 "$i";
done
zenity --info --text "Image successfully compressed!"

Find more questions by tags Optimization of imagesMint