User1417933 84522 gold badges1111 silver badges1414 bronze badges 1 There seem like python bindings to ImageMagick: imagemagick.org/download/python. I haven't made use of them, but I've employed ImageMagick, and it'll do what you want. user1342784 From there, it had been only a short strategy to make use of the aforementioned equation https://elliotexooi.pointblog.net/image-to-jpg-an-overview-87882380