Capture images in Hypermesh with Image size

Roshan Shiveshwar
Roshan Shiveshwar Altair Community Member
edited October 2020 in Community Q&A

Hi,

 

Hypermesh has an API '*jpegfilenamed' to capture images. But, with this I am not able to control the size of the images.  Is there any way to achieve this?

 

In Hyperview, we have an  API  ' CaptureScreenToSize' that enables us to capture images with different sizes. I am looking for a similar option in Hypermesh.

 

Thanks

Answers

  • tinh
    tinh Altair Community Member
    edited July 2017

    Hi,

    B)/emoticons/default_cool.png' title='B)' />write your own function, like this:

     proc ::p_CaptureGraphic {Size {FilePath {}} {Center {}}} {     lassign [hm_getgraphicsarea] x y w h     lassign $Size W H     lassign $Center Cx Cy     if {[string equal '' $H]} {set H $W}     if {[string equal '' $Cx]} {set Cx 0; set Cy 0}     if {[string equal '' $Cy]} {set Cy $Cx}     set X [expr $x+$w/2+$Cx-$W/2]     set Y [expr $y+$h/2+$Cy-$H/2]     if {[string equal '' $FilePath]} {         hm_windowtoclipboard $X $Y $W $H     } else {         hm_windowtofile $X $Y $W $H $FilePath     } }  #example, copy a square 100x100 at center of graphic: p_CaptureGraphic 100 file1.jpg #copy 200x300  p_CaptureGraphic {200 300} file2.jpg #copy 50x50 near by right bottom corner (offset x100 y100 from center of graphic): p_CaptureGraphic 50 file3.jpg {100 100}

     

  • Roshan Shiveshwar
    Roshan Shiveshwar Altair Community Member
    edited August 2017

    Thanks tinh.

     

    This is a useful code where I can control the area of the screen that I want to capture.

     

    Actually, I want to capture the entire HM graphics screen and then control the size of the resulting image. So, anyway I can do that?

  • tinh
    tinh Altair Community Member
    edited August 2017

    Do you mean you want to zoom in/out ?

  • Roshan Shiveshwar
    Roshan Shiveshwar Altair Community Member
    edited August 2017

    No, I dont want to zoom.

     

    Say, if my '*jpegfilenamed' API captures image with size 1162*722.  I want the same image to be resized to 722*722, so that I can easily populate them in my Powerpoint presentations.

  • tinh
    tinh Altair Community Member
    edited August 2017

    I understand,

    You want to crop the image, dont you?

    Because otherwise it is stretched/collapsed similar to zooming

  • Roshan Shiveshwar
    Roshan Shiveshwar Altair Community Member
    edited August 2017

    Well, I don't want to crop the image. Instead, I  want the entire image to be resized.

     

    Something like this...

     

    <?xml version="1.0" encoding="UTF-8"?>Capture.JPG

  • tinh
    tinh Altair Community Member
    edited August 2017

    Ok. Please refer to

    Http://wiki.tcl.tk/11196

  • Roshan Shiveshwar
    Roshan Shiveshwar Altair Community Member
    edited August 2017

    Thanks tinh,

     

    This should help.. :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />