[ma...] Posted October 26, 2023 Share Posted October 26, 2023 Hello, Can you export image's from gom inspect to jpg file and save them on your computer. So that you take this in a excel sheet I would like to do it with scripting. Thanks Link to comment Share on other sites More sharing options...
[Na...] Posted October 26, 2023 Share Posted October 26, 2023 Hi, what kind of images? Link to comment Share on other sites More sharing options...
[ma...] Posted October 26, 2023 Author Share Posted October 26, 2023 (edited) Images that i make in gom inspect that there are in the pdf report but van these images i think jpg of png want these to take in to excel report and in no pdf Edited October 26, 2023 Link to comment Share on other sites More sharing options...
[3c...] Posted October 26, 2023 Share Posted October 26, 2023 (edited) I posted this as a reply to another user, it exports all images from your report pages into a folder that you select- # -*- coding: utf-8 -*- import os import gom dialog=gom.script.sys.execute_user_defined_dialog (content='<dialog>' \ '<title>Export to folder:</title>' \ '<control id="OkCancel"/>' \ '<size height="100" width="200"/>' \ '<content columns="1" rows="1">' \ '<widget type="input::file" row="0" rowspan="1" column="0" columnspan="1">' \ '<name>folder</name>' \ '<type>directory</type>' \ '<title>choose folder:</title>' \ '<default></default>' \ '<limited>false</limited>' \ '<file_types/>' \ '<file_types_default></file_types_default>' \ '</widget>' \ '</content>' \ '</dialog>') export_folder = dialog.folder.replace('/', os.sep) for report in sorted(gom.app.project.reports): for element in report.pages[0].elements: if element.type == 'figure_snapshot_frame': i = 1 while True: if os.path.exists(os.path.join(export_folder, '{} {}.png'.format(report.name, i))): i += 1 else: break gom.script.report.export_report_image_as_png(images=element, file=os.path.join(export_folder, '{} {}.png'.format(report.name, i)), use_original_size=True, disable_transparency=True) Edited October 26, 2023 Link to comment Share on other sites More sharing options...
[ma...] Posted November 10, 2023 Author Share Posted November 10, 2023 it works for .png file but can you do this also for jpg Link to comment Share on other sites More sharing options...
[3c...] Posted November 13, 2023 Share Posted November 13, 2023 this should work for .jpg # -*- coding: utf-8 -*- import os import gom dialog=gom.script.sys.execute_user_defined_dialog (content='<dialog>' \ '<title>Export to folder:</title>' \ '<control id="OkCancel"/>' \ '<size height="100" width="200"/>' \ '<content columns="1" rows="1">' \ '<widget type="input::file" row="0" rowspan="1" column="0" columnspan="1">' \ '<name>folder</name>' \ '<type>directory</type>' \ '<title>choose folder:</title>' \ '<default></default>' \ '<limited>false</limited>' \ '<file_types/>' \ '<file_types_default></file_types_default>' \ '</widget>' \ '</content>' \ '</dialog>') export_folder = dialog.folder.replace('/', os.sep) for report in sorted(gom.app.project.reports): for element in report.pages[0].elements: if element.type == 'figure_snapshot_frame': i = 1 while True: if os.path.exists(os.path.join(export_folder, '{} {}.jpg'.format(report.name, i))): i += 1 else: break gom.script.report.export_report_image_as_png(images=element, file=os.path.join(export_folder, '{} {}.jpg'.format(report.name, i)), use_original_size=True, disable_transparency=True, format='JPEG') Link to comment Share on other sites More sharing options...
[Ah...] Posted April 13 Share Posted April 13 Please sign in to view this quote. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in