We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Save Screeshot/Snapshot to Jpg file

Home Forums Puzzles Save Screeshot/Snapshot to Jpg file

Viewing 15 posts - 1 through 15 (of 40 total)
  • Author
    Posts
  • #18599
    Manuel
    Customer

    Hi

    I want to add a button to save the current view of a object to a jpg file

    Is it possible?

    Thanks

    #18604

    Hi,

    You can use the take screenshot puzzle for that (also need to enable screenshots with configure app puzzle). It only generates the image though. To be able to download it, you can use the following JavaScript snippet

        app.ExternalInterface.downloadScreenshot = function(image) {
            var link = document.createElement('a');
            link.setAttribute('download', 'myImage.png');
            link.setAttribute('href', image);
            link.click();
        }

    and call it from Puzzles as described here.

    Attached an example project.

    Attachments:
    You must be logged in to view attached files.

    Chief 3D Verger | LinkedIn | Twitter

    #18609

    Update:

    make it

        app.ExternalInterface.downloadScreenshot = function(image) {
            var link = document.createElement('a');
            document.body.appendChild(link);
            link.setAttribute('download', 'myImage.png');
            link.setAttribute('href', image);
            link.click();
        }

    to work on Firefox.

    Chief 3D Verger | LinkedIn | Twitter

    #18614
    Manuel
    Customer

    Thanks a lot

    The only problem now, is that i get a black image :-S

    Any idea that can be?

    Thanks

    #18615

    also need to enable screenshots with configure app puzzle)

    :)

    Chief 3D Verger | LinkedIn | Twitter

    #18616
    Manuel
    Customer

    Fixed!

    Sorry, i hadn’t checked the option in initialization panel ^^

    Thanks :good:

    #18618
    Manuel
    Customer

    Now i see that, another question…

    Is there any possibility to change the background automatically or make it transparent when you save the pic?

    Thks again ^^

    #18620

    Try the transparent background option in the same puzzle: https://www.soft8soft.com/docs/manual/en/puzzles/Initialization.html#configure_application

    Chief 3D Verger | LinkedIn | Twitter

    #18623
    Manuel
    Customer

    Try the transparent background option in the same puzzle: https://www.soft8soft.com/docs/manual/en/puzzles/Initialization.html#configure_application

    As i have a sphere background, i solve it like this (look attached file)

    Is there any cleaner form to do it?

    Because here, i depend of cpu speed, i suppose isn’t it?

    #18625

    Yep, you can use 0 second time to make it lapse only 1 rendering frame.

    Chief 3D Verger | LinkedIn | Twitter

    #18628
    Manuel
    Customer

    Yep, you can use 0 second time to make it lapse only 1 rendering frame.

    I tested it, but i doesn’t work :-S

    #18634

    What does it produce? non-transparent background?

    Chief 3D Verger | LinkedIn | Twitter

    #18636
    Manuel
    Customer

    What does it produce? non-transparent background?

    Correct!

    It seems that with “0” value, there’s no time to grab the transparent backgroud.

    #18637

    you can try another approach – using the every frame puzzle with a counter to wait for 1 or 2 rendering frames.

    Chief 3D Verger | LinkedIn | Twitter

    #18698
    Manuel
    Customer

    you can try another approach – using the every frame puzzle with a counter to wait for 1 or 2 rendering frames.

    I don’t know how to use it, as i can’t puzzle it into my “click” function :-S

Viewing 15 posts - 1 through 15 (of 40 total)
  • You must be logged in to reply to this topic.