The script will only edit the file format you specify. Make sure that the pictures are in jpg and not jpeg or anything else. Replace according to your values and it should work. I tested the script multiple times, and there doesn't appear to be any issues in it. Make sure you enter the correct folders' paths as well. If it edited 15 pictures when set to png that means you have 15 pictures that use the png format in the folder you specified.