Skip to content

OSError: cannot write mode RGBA as JPEG #44

Open

Description

@tristanlatr

Hello,

Thanks for this tool, I'm trying to process diff on a PDF of 250 pages plus and getting this error. It works with 'png' format but it barely readable and images reader hangs because the file is too large...

Calling

% pdf-diff -f jpeg v1.pdf v2.pdf > diff.jpeg

I Get:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py", line 614, in _save
    rawmode = RAWMODE[im.mode]
KeyError: 'RGBA'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/pdf-diff", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/pdf_diff/command_line.py", line 499, in main
    img.save(sys.stdout.buffer, args.format.upper())
  File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2158, in save
    save_handler(self, fp, filename)
  File "/usr/local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py", line 616, in _save
    raise OSError("cannot write mode %s as JPEG" % im.mode) from e
OSError: cannot write mode RGBA as JPEG

I'm on macOS Catalina.
Thanks for your help :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions