The extension ${X%pattern} removes the pattern end of $ X.
convert "$1" -resize 50% "${1%.*}.jpg"
To work with multiple files:
for filename ; do convert "$filename" -resize 50% "${filename%.*}.jpg" done
This will result in a jump for each command line argument and abbreviation for for filename in " $@ " . You don't have to worry about checking if the *.png argument is - the shell will expand it for you - you just get an extended list of file names.
source share