getSizeConvertor = (width, height) =>
  function convert(data, size = width) {
    if (typeof data === "number") return convertToFixed((data * 100) / size);
    if (Array.isArray(data)) {
      if (data.length === 2) return [convert(data[0]), convert(data[1], height)];
      return data.map((n) => convert(n));
    }
    if (typeof data === "object") {
      const result = {};

      for (const key in data) {
        if (key === "rotation") result[key] = data[key];
        else if (key.startsWith("height") || key === "y" || key.endsWith("Y")) result[key] = convert(data[key], height);
        else result[key] = convert(data[key]);
      }
      return result;
    }
    return data;
  }
Create convertor for any measures to relative form on image with given dimensions
Accepts numbers, arrays ([x, y] treated as a special coords array) and hash objects
With [706, 882] given as image sizes:
  assert.equal(convertToImageSize(123), 17.42);
  assert.deepEqual(convertToImageSize([123, 123]), [17.42, 13.95]);
  assert.deepEqual(
    convertToImageSize({ width: 123, height: 123, radiusY: 123, coords: [123, 123] }),
    { width: 17.42, height: 13.95, radiusY: 13.95, coords: [17.42, 13.95] }
  );
@param {number} width
@param {number} height