Last Updated on 9 de Janeiro, 2021 by Vítor Fernandes
PNG supports palette-based images (with palettes of 24-bit RGB or 32-bit RGBA colors), grayscale images (with or without alpha channel for transparency), and full-color non-palette-based RGB or RGBA images. The PNG working group designed the format for transferring images on the Internet, not for professional-quality print graphics; therefore non-RGB color spaces such as CMYK are not supported.wikipedia
You don’t need to be on a Linux system for this to work. You can use only the terminal for this. Use the Linux subsystem! For further clarification on the operation of the module, view the commands allowed on the official webpage.
1 – Install the ImageMagick module.
sudo apt-get install imagemagick -y
2 – Convert multiple JPG images to PNG.
for i in *.jpg; do convert -strip -interlace plane -background none -alpha remove -flatten -quality 80 $i $(echo $i | sed 's/jpg/png/g'); done
Convert multiple PNG images to JPG
for i in *.jpg; do convert -strip -interlace plane -background "#ffffff" -alpha remove -flatten -quality 80 $i $(echo $i | sed 's/png/jpg/g'); done