Error when exporting from OMERO.figure to Pdf

Hi all,

We just got this error message when trying to export a figure to pdf:

Traceback (most recent call last):
File “./script”, line 2315, in
File “./script”, line 2301, in run_script
file_annotation = export_figure(conn, script_params)
File “./script”, line 2257, in export_figure
return fig_export.build_figure()
File “./script”, line 962, in build_figure
self.add_panels_to_page(panels_json, image_ids, page)
File “./script”, line 1773, in add_panels_to_page
self.add_rois(panel, page) # This does nothing for TIFF export
File “./script”, line 1100, in add_rois
File “./script”, line 239, in init
super(ShapeToPdfExport, self).init(panel)
File “./script”, line 173, in init
getattr(self, ‘draw_%s’ % s[‘type’].lower(), lambda s: None)(s)
File “./script”, line 217, in draw_rectangle
File “./script”, line 411, in draw_polygon
stroke_width = shape[‘strokeWidth’]
KeyError: ‘strokeWidth’

The error is reproducible, but apparently specific to this figure, i.e. pdf export still works fine with other figures.
The figure consists of 18 electron micrographs, each 32bit, 4096x4096 px.
We are running OMERO 5.4.10 with omero-figure 4.0.2 and the newest version of the Figure_To_Pdf script.
Can anyone explain why this error occurs?

Hi, thanks for the feedback.
It seems that theres an ROI on one of the panels that doesn’t have a setting for the line thickness (strokeWidth).
If you go through the panels and explicitly pick a line width for each ROI (or you can select multiple panels and pick the line-with for all at once in the right tab under ROIs), that should fix it.
This probably happened if you copied a region and pasted it as a Rectangle, or some other ROI creation step?
I created a card for this bug at


1 Like

Hi Will,
Explicitly setting the line thickness of all ROIs in fact solved the problem! Indeed the same ROI was copied several times to multiple images.
Thanks a lot!!