0

I have made a script which makes a valid ppm file which when opened using a ppm viewer is working properly.

But I don't want my users to install a ppm viewer to view their output images instead I want it to be converted to a global file format like a JPG/JPEG or PNG.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • You need to help the community understand what you have done so far to try and resolve the issue. That will guide them to getting you a solution that might be acceptable for you. Also, look for existing question like this, such as the one answered here: https://stackoverflow.com/questions/26937143/ppm-to-jpeg-jpg-conversion-for-python-3-4-1 – AlienFromCA Mar 22 '22 at 14:52
  • 2
    Does this answer your question? [PPM to JPEG/JPG conversion for Python 3.4.1](https://stackoverflow.com/questions/26937143/ppm-to-jpeg-jpg-conversion-for-python-3-4-1) – AlienFromCA Mar 22 '22 at 14:53
  • Please click [edit] and show the first 3 lines of your PPM file. – Mark Setchell Apr 18 '22 at 20:14

1 Answers1

0

You can use Pillow module for python.

from PIL import Image
with Image.open("your_ppm_file.ppm") as im:
     im.save("your_jpg_file.jpg")

Hope this might be helpful.

Lavish
  • 3
  • 3