Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend throws an exception for generating a PDF with specific images #158

Open
bartjkdp opened this issue May 28, 2021 · 0 comments
Open
Labels
bug Something isn't working

Comments

@bartjkdp
Copy link

bartjkdp commented May 28, 2021

The backend throws the following exception when generating a PDF containing specific images:

File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "./signals/apps/api/pdf/views.py", line 11, in get
context = self.get_context_data(**kwargs)
File "./signals/apps/api/views/pdf.py", line 112, in get_context_data
jpg_data_uris = DataUriImageEncodeService.get_context_data_images(self.object, self.max_size)
File "./signals/apps/services/domain/images.py", line 59, in get_context_data_images
image.save(new_buffer, format='JPEG')
File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2172, in save
save_handler(self, fp, filename)
File "/usr/local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py", line 635, in _save
raise OSError(f"cannot write mode {im.mode} as JPEG") from e
OSError: cannot write mode RGBA as JPEG

For more details see report 13386 @ DB.

@bartjkdp bartjkdp added the bug Something isn't working label May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant