Saving thumbnails¶
Saving thumbnails¶
1# This example shows how to save drawing and layer thumbnail images for the active drawing
2# For layers the optional LAYERS.l_thumb picture column should be defined in the database otherwise
3# retrieving multiple layer previews for the same project will be slow
4impact.gui.output_toolbox.clear()
5
6if not impact.active_drawing.isNone():
7 d = impact.active_drawing
8 db_item = d.database_item
9
10 if db_item.save_thumbnail_to_file("e:\temp\\drawing" + db_item.key + ".jpg", ipFileFormat.ffJPG, True):
11 impact.gui.output_toolbox.add("Saved drawing preview '" + str(db_item.reference) + "'")
12 else:
13 impact.gui.output_toolbox.add("Unable to save drawing preview")
14
15 for l in db_item.layers:
16 if l.save_thumbnail_to_file("e:\temp\\layer " + l.key + ".jpg", ipFileFormat.ffJPG, True):
17 impact.gui.output_toolbox.add("Saved layer preview for '" + l.name + "'")
18 else:
19 impact.gui.output_toolbox.add("Unable to save layer preview")
20
21else:
22 impact.gui.output_toolbox.add("No active drawing")
23