JoshData/pdf-diff

OSError: cannot write mode RGBA as JPEG

tristanlatr opened this issue · 0 comments

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 :)