Image functionality ported from pdf.js
function determineWidthAndHeight(w, h, info) {
    if (!w && !h) {
      w = -96;
      h = -96;
    }

    if (w < 0) {
      w = -1 * info['w'] * 72 / w / this.internal.scaleFactor;
    }

    if (h < 0) {
      h = -1 * info['h'] * 72 / h / this.internal.scaleFactor;
    }

    if (w === 0) {
      w = h * info['w'] / info['h'];
    }

    if (h === 0) {
      h = w * info['h'] / info['w'];
    }

    return [w, h];
  }