ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 31 forks source link

Export as TIF fails depending on paper size #321

Closed erickmartins closed 5 years ago

erickmartins commented 5 years ago

We've recently had a user report that exporting a figure as TIF fails. Upon further investigation, it only failed when using a custom paper size/"crop page around panels" option, but not when using A4, for example. The error is as follows:

Traceback (most recent call last): File "./script", line 1875, in run_script() File "./script", line 1861, in run_script file_annotation = export_figure(conn, script_params) File "./script", line 1818, in export_figure return fig_export.build_figure() File "./script", line 669, in build_figure self.create_figure() File "./script", line 1537, in create_figure self.tiff_figure = Image.new("RGBA", (tiff_width, tiff_height), rgb) File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 1801, in new return Image()._new(core.fill(mode, size, color)) TypeError: integer argument expected, got float

Latest OMERO version and latest Figure version.

rgozim commented 5 years ago

Hi Erick! The error looks like it is occurring in the pillow dependency. Can you let us know which version of pillow the user is using on their system (running pip freeze in a terminal should give you a list of pip installed packages)?

I have tested pillow 3.3.3, which is specified in omero web requirements.txt, and version 5.3 and could not reproduce the error.

erickmartins commented 5 years ago

The web server is running the latest pillow available (Pillow==5.4.1). Tried downgrading it to Pillow==3.3.0 and the error persists.

rgozim commented 5 years ago

Hi Erik, looking through the code of figure_to_pdf.py, I can't find the line reported in your users error message self.tiff_figure = Image.new("RGBA", (tiff_width, tiff_height), rgb). Could you check to see if your user is using the latest version of the export script?

will-moore commented 5 years ago

Hi Erik, Apologies: as we realised recently (see https://www.openmicroscopy.org/community/viewtopic.php?f=4&t=8660&start=10) our docs don't explain about the updating of the figure export script when upgrading figure. We'll try to fix that. Will

erickmartins commented 5 years ago

You were right, the new version of the script did the trick. Thanks!