Skip to Main Content
コグネックスサポートハブ
LogoLogo

How to Save a CogRecord including input image + graphics as an image (.bmp, .jpg...)

Easy way of saving records as images

2025/05/07

Question

In your Designer application, you might have a Record generated by a Tool/ToolBlock or a Merge Graphics Block including the Input Image and all the Graphics and might want to Save it as a Bitmap/other Image format.

Answer

An easy way of doing it is to have a VisionPro Display on the Designer Project Page linked to that Record and an OnClick Button Script to save its content.

Placeholder

The On Mouse Click Script should look like:

$counter = $counter + 1; //increasing the counter at each run
$filename = "C:\Users\...\image_" + $counter + ".bmp"; //path + counter + desired image format (.bmp/.jpg,....)

$Pages.Page.VisionProDisplay.Save(true, $filename);

where $counter (int) and $filename (string) are two Tags (global variables).

By running the application, when clicking on the "Save" button, the image will be saved at the specified path.

 

関連リソース