How to mekescreenshot_hires() with different resolution according to camera resolution

  • Hello everyone,

    I'm using this example : https://krpano.com/docu/plugininterface/….makeScreenshot. It work's well to have a 4000 x 2250 resolution, however a Z1 image (RICOH THETA camera) has better resolution (6720 x 3360) than SC2 image (3840 x 1920).

    My first question is
    How can I have correct width and height of mekescreenshot_hires() according to the device. I can't set 4000 * 2250 for all captured image because I would like to have different size beetween my original image (can be equal to 7000 x 3500 or 5376 x 2688 or smaller) and image that was made by makescreenshot_hires(). Is it possible ?

    My second question is
    I put code generated by krpano. So, multires="512,1024,2176", how can I convert "2176" (multires value) to flat image ?

    Code
    <preview url="preview.jpg" /><image prealign="-0.00|38.40|-0.00" if="!(webvr.isenabled OR device.mobilevr)">
    	<cube url="%s/l%l/%v/l%l_%s_%v_%h.jpg" multires="512,1024,2176" />
    </image><image prealign="-0.00|38.40|-0.00" if="webvr.isenabled OR device.mobilevr">
    	<cube url="vr/pano_%s.jpg" />
    </image>


    Thank's a lot

  • Hi,

    you can render a 'screenshot' in any resolution you want, but you're will be limited by the browsers/systems max. WebGL renderbuffer size (on low-end of mobile devices typically 4096x4096, on desktop systems typically 16384x16384).

    The resolution of the source image doesn't matter for that and the resolution of the camera even more not. The field-of-view and projection is also something to consider here!

    For loading the tiles from a certain resolution for the screenshot, have a look at the included screenshot example and there at the 'makescreenshot_hires' action:
    https://krpano.com/examples/#makescreenshot-api

    Best regards,
    Klaus

  • Thanks for your reply Klaus,


    how can I get max capture size according browsers/systems, I mean which params should I have to define max size. You told : "you want, but you're will be limited by the browsers/systems max", so I need to know which device (desktop or mobile), what are the others params/limitations that allow me to define max size.


    Thank's a lot for your explation

  • Hi,

    if your aim is rendering a screenshot in the maximum possible resolution on a certain device, just use a very large size, krpano will then automatically (proportionally) reduce the size to the max possible one.

    But for manually getting the max supported size, this piece of Javascript code can be used:

    Code
    var gl = krpano.webGL.context;
    var max_renderbuffer_size = gl.getParameter( gl.MAX_RENDERBUFFER_SIZE );

    Then the max_renderbuffer_size variable will contain the maximum width or height.

    More details here:
    https://krpano.com/docu/plugininterface/#krpanowebglapi

    Best regards,
    Klaus

  • I tried to use

    Code
    krpano.webGL.context.getParameter( gl.MAX_RENDERBUFFER_SIZE )

    but when downloading image I got different size. I show you my code :


    Code
    var gl = krpano.webGL.context;
    var max_renderbuffer_size = gl.getParameter( gl.MAX_RENDERBUFFER_SIZE );
    screenshotwidth = max_renderbuffer_size;
    
    
    screenshotheight = max_renderbuffer_size / (16/9);
    
    
    var screenshotcanvas = krpano.webGL.makeScreenshot(screenshotwidth, screenshotheight, true, "canvas", 0, null, sizeinfo, makeScreenshotCache);


    When I display max_renderbuffer_size (using alert()) on my browser I got 16384, why my final image is equal to 7679px x 4319px. Is there something that i didn't understand or missed ?

    Thank you for giving me your time !

  • Hi klaus.krpano,

    krpano.webGL.context.getParameter( gl.MAX_RENDERBUFFER_SIZE ) give me 16384, you told me
    "max_renderbuffer_size variable will contain the maximum width or height.", but when I execute :


    Code
    var screenshotwidth = 16384;var screenshotheight = 9637;
    var screenshotcanvas = krpano.webGL.makeScreenshot(screenshotwidth, screenshotheight, true, "canvas", 0, null, sizeinfo, makeScreenshotCache);


    My screenshot has 7509px / 4417px, I thought I have exceeded the maximum value, so max_renderbuffer_size does not
    contain the maximum width. did i make a mistake ? Is there another way to have max width value supported for my browser/systems ?

    Edited once, last by djck (June 4, 2021 at 9:47 AM).

  • Apologies for jumping in but where are the screenshots saved when viewing the tour on a pc? I'd like to take some high res shots and save them to a directory.

    Hi @andrew22222,

    I'm using this example : https://krpano.com/viewsource.htm…api-example.xml.

    So when this layer is clicked :

    Code
    krpano.addlayer("screenshotsaveasbutton");

    this function is executed

    Code
    saveasbutton.onclick()


    So I'm working on Ubuntu 20.04, my image is downloaded and I can find in "/home/username/Téléchargements"

    I hope it will help you.

  • Thanks Djck,

    I looked and found that part in the xml file and so you changed it to this below *wink*

    Code
    screenshotcanvas.toBlob(function(blob){ krpano.screenshotSaveAs(blob,"screenshot" + (krpano.makescreenshot_count++) + ".jpg"); }, "/home/username/Téléchargements", 0.95);


    Cheers.

  • How can I destroy the photo screen when I click the save button?
    Normally the selected area disappears when clicked, but I want to do it when the photo is saved in one action.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!