Search code examples
pythonimage-processingjpeg2000

How to convert a JPEG2000 to JPEG in Python?


I have a JPEG 2000 Image, and want to convert it to a simple JPEG image, so that it will be visible in all browsers.

I tried looking at PythonMagic. I downloaded it from here and installed it, but couldn't find any documentation, on how to use it.

I have already used PIL in the past, but it doesn't support JPEG 2000.

The process needs to run on Windows 2008 R2, with Python 2.7. If another Python version needs to be installed, I can do that as well.


Solution

  • pgmagick Here is the python library which you looking for.

    I tried and it does covert .jp2 to .jpeg format.

    from pgmagick import Image
    
    img = Image('CB_TM432.jp2') # Input Image
    img.write('CB_TM432.jpeg')  # Output Image