Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ozcan-durak/dd6845e21ee0cfdd49917e2ff49b5cc9 to your computer and use it in GitHub Desktop.

Select an option

Save ozcan-durak/dd6845e21ee0cfdd49917e2ff49b5cc9 to your computer and use it in GitHub Desktop.

Revisions

  1. ozcan-durak created this gist Jun 28, 2021.
    17 changes: 17 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    //This script has been written for test purposes within couple mins.

    //Change this according to your canvas. Grab this from inspect element!
    var can = document.querySelector('canvas.canvas-outline.ng-tns-c340-20.lower-canvas');

    //Resize the image for IOS 6.5" screens.
    var resizedCanvas = document.createElement("canvas");
    var resizedContext = resizedCanvas.getContext("2d");
    resizedCanvas.height = "2688";
    resizedCanvas.width = "1242";

    //To resize the image
    resizedContext.drawImage(can, 0, 0, 1242, 2688);
    var myResizedData = resizedCanvas.toDataURL();

    console.log(myResizedData); //This will give you a base64 image output.
    //use this website to generate & download * https://codebeautify.org/base64-to-image-converter