ImageMagick mogrify does not overwrite original files
ImageMagick's mogrify
isn't the best tool here, turns out convert
is much better suited for the job. It can be done by specifying output format with the file name.
convert a.jpg png:a.jpg
Example:
$ file a.jpg
a.jpg: JPEG image data, JFIF standard 1.01
$ convert a.jpg png:a.jpg
$ file a.jpg
a.jpg: PNG image data, 300 x 199, 8-bit/color RGB, non-interlaced