MV I cannot extend a picture / bitmap.

Hey! I am developing a plugin for my project that displays a screen of where the player is saving.

Depending on the screen resolution, I need to enlarge or shrink this image.

The reduction is done without any problem with the code below. On the other hand, as soon as I try to enlarge, even by 1%, the image is not displayed.

Anyone know why?

JavaScript:
Window_SaveInfo.prototype.updateCountdown = function() {
  if (this._countdown > 0) {
    this._countdown -= 1;
    if (this._countdown <= 0) this.refreshPic();
  }
};

Window_SaveInfo.prototype.refreshPic = function() {
  if (this._countdown > 0) return;
    var id = this.savefileId();
  this.drawPicture("Save" + id, 0, 370);
};


Window_SaveInfo.prototype.drawPicture = function(pictureName, x, y) {
    var bitmap = ImageManager.loadPicture(pictureName);
    var testx = (1640 / bitmap.width);
    var testy = (496 / bitmap.height);
    var pw = (testx * bitmap.width);
    var ph = (testy * bitmap.height);
    var sx = 0;
    var sy = 0;
    this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
    if (bitmap.width <= 0 && this._countdown <= 0) {
    this._countdown = 5;
    this.refreshPic();
    }
};

Thanks for your help !
this line probably dont work correctly, while you use testx and testy

this.contents.blt(bitmap, sx, sy, pw, ph, x, y);

I think if you want to scale it correctly, use (Graphics.boxWidth - X) / Y;

X for the pixels, and Y to divide it to fit, depending if its in the window or not.
if the image become to large than the window, it's either cut off, or not visible.
Sorry but I couldn't get it to work with your code, the result was the same as mine.

However, I found a solution!

I went from

this.contents.blt (bitmap, sx, sy, pw, ph, x, y,);

at

this.contents.blt (bitmap, sx, sy, pw, ph, x, y, w, h);
w and h being the final values of the resize.

Thank you anyway for your help!

Original thread: https://forums.rpgmakerweb.com/threads/i-cannot-extend-a-picture-bitmap.128352/