These scripts can change format of images from PNG to JPG and JPG to PNG
Required Modules
- PIL==1.1.6
To install:
$ pip install -r requirements.txt
- Dynamic Change
Copy the script
convertDynamic.pyinto the directory where images are (PNG and/or JPG). And run:This will convert all JPG images to PNG and PNG images to JPG in the present directory tree recursively (i.e. will change format in images inside sub-directories too.)$ python convertDynamic.py
- JPG to PNG (single image)
- Copy the JPG image to the directory where
JPGtoPNG.pyexists - Replace file name
naruto_first.jpginsideJPGtoPNG.py(line 3) to input file name (JPG). - Replace file name
naruto.pnginsideJPGtoPNG.py(line 4) to output file name (PNG). - Run following command:
$ python JPGtoPNG.py
- Copy the JPG image to the directory where
- PNG to JPG (single image)
- Copy the PNG image in directory where
PNGtoJPG.pyexists - Replace file name
naruto_first.pnginsidePNGtoJPG.py(line 3) to input file name (PNG). - Replace file name
naruto.jpginsidePNGtoJPG.py(line 4) to output file name (JPG). - Run following command:
$ python PNGtoJPG.py
- Copy the PNG image in directory where