Show Picture to fit the screen

Discussion in 'RPG Maker MV' started by Arise, Jan 14, 2018.

Thread Status:
Not open for further replies.
  1. Arise

    Arise Veteran Veteran

    Messages:
    131
    Likes Received:
    18
    A "simple" question?!?

    I have some high resolution images that I would like to show on screen, but the usual Show Picture command is not resizing the image to fit on screen. I don't want stretching, I'm fine with back bars, I only want some 1920x1080 (full hd) picture for example to be displayed scaled/fit on the RPG Maker MV window.

    How do I accomplish that?
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,632
    Likes Received:
    6,575
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Best way would be to use an image program like gimp or Photoshop to resize it to your game's screen size and then use that.

    As you discovered, there is no automatic resize in RMs (or most 2d programs). Theoretically it might be possible to have a plugin do that, but that would be a bad way only to be used if nothing else works. That is because there are different mathematical formulae to do the resize, and the formulae that can be programmed in a simple way usually result in a quality loss and fragmentation.
    Dedicated image programs usually have much better formulae for resizing (often giving a choice on which to use) and that will always result in a better quality as well as less wasted space in the project.
     
    #2
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,806
    Likes Received:
    11,510
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Show Picture has a Zoom setting so you could enlarge/reduce it.
     
    #3
  4. Arise

    Arise Veteran Veteran

    Messages:
    131
    Likes Received:
    18
    I sort of agree, but for the sake of it, lets say the images I have are 1920x1080, which is way bigger than the default RPG Maker MV resolution.
    Also I would like to provide several custom resolutions, up to 1920x1080, I would like the game to resize the Intro/Scenes-Story/Final-GameOver mesaages based on the chosen resolution.

    I dont know how the Show Picture works behind the scene, but I was under the impression that rescaling is done automaticaly because the game is using Chrome browser, so I should not worry of any down-scale algorithm for producing bad visual results.

    About the scale parameter in Show Picture command, yes it could work, but only if I know the screen width/height before hand, and this would be something to do every time, for every picture.

    Basically, I would need a special parameter in the Show Picture interface, like “Fit Image to Screen” that will do exactly that (eventually centered) and ignore the rest of parameters like zoom and X and Y.
     
    #4
  5. Super-User

    Super-User Villager Member

    Messages:
    21
    Likes Received:
    5
    First Language:
    Chinese
    Primarily Uses:
    RMVX
    I need the same thing

    For part of a solution, one line of JavaScript to retrieval the height of game screen is:
    parseInt(document.getElementById("GameCanvas").getAttribute("height")) // replace"height" with "width" for counter part
    And for the image size:
    ImageManager.loadPicture($gameScreen._pictures[1].name()).height // replace"height" with "width" for counter part
    For the missing piece of puzzle:
    $gameScreen.showPicture()
    This function is not well documented yet. I tried to call it, but results not showing any image. Provided correct way to call this function, I can calculate the correct scale and position for each. (I am a programmer.)

    Alright, I tried to call $gameScreen.showPicture() with the same parameters, and failed with following messages:

    rpg_managers.js:1949 TypeError: Cannot read property 'length' of undefined
    at WebGLState.setBlendMode (pixi.js:18126)
    at PictureRenderer._renderNormal (pixi-picture.js:185)
    at PictureRenderer.render (pixi-picture.js:179)
    at Sprite_Picture.Sprite._renderWebGL (rpg_core.js:4401)
    at Sprite_Picture.renderWebGL (pixi.js:9346)
    at Sprite.renderWebGL (pixi.js:9350)
    at Spriteset_Map.renderWebGL (pixi.js:9350)
    at Scene_Map.renderWebGL (pixi.js:9350)
    at WebGLRenderer.render (pixi.js:17526)
    at Function.Graphics.render (rpg_core.js:1875)

    It seems this is a bug of pixi.js . I have opened an issue here: https://github.com/pixijs/pixi.js/issues/5573
     
    Last edited by a moderator: Apr 11, 2019
    #5
  6. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,964
    Likes Received:
    10,658
    First Language:
    English
    Primarily Uses:
    RMVXA
    @Super-User Please do not double post - that is, post straight after yourself in less than 72 hours. I have merged your 4 posts together.

    I think it would be better to discuss this in Javascript/Plugin Support, as I think the coding discussion would go way beyond this section of the forum, and you're more likely to attract the attention of coders if you post there.

    Closing this

     
    #6
    Super-User likes this.
Thread Status:
Not open for further replies.

Share This Page