Canvas stuff bro I'm lazy to explain

by RFour · Jul 13, 2026 ·javascript

if someone show me this photo in 70 years, I won't remember anything But in my head something will definitely flicker

CanvasLarpJPG
gatau.jsjavascript
1const { createCanvas, loadImage } = require('@napi-rs/canvas');
2const axios = require('axios');
3const FormData = require('form-data');
4
5async function imgbb(image) {
6  var { data: html, headers } = await axios.get('https://imgbb.com/');
7  var token = html.match(/auth_token\s*=\s*["']([a-f0-9]+)["']/)?.[1];
8
9  var form = new FormData();
10  form.append('source', image, `${Date.now()}_rfourlovesyou.jpg`);
11  form.append('type', 'file');
12  form.append('action', 'upload');
13  form.append('timestamp', Date.now().toString());
14  form.append('auth_token', token);
15
16  var { data } = await axios.post('https://imgbb.com/json', form, {
17    headers: {
18      ...form.getHeaders(),
19      cookie: headers['set-cookie'].join('; '),
20      origin: 'https://imgbb.com',
21      referer: 'https://imgbb.com/',
22      'user-agent': 'Mozilla/5.0 (Linux; Android 15; SM-F958 Build/AP3A.240905.015) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.86 Mobile Safari/537.36'
23    }
24  });
25
26  return data.image.image;
27}
28
29async function gataulah(overlayurl) {
30  var baseurl = "https://files.catbox.moe/nip43r.jpg";
31  var bx = 0, by = 240, bw = 1280, bh = 856;
32
33  var baseRes = await fetch(baseurl, { headers: { 'User-Agent': 'Mozilla/5.0' } });
34  var baseBuf = Buffer.from(await baseRes.arrayBuffer());
35  var base = await loadImage(baseBuf);
36
37  var ovRes = await fetch(overlayurl, { headers: { 'User-Agent': 'Mozilla/5.0' } });
38  var ovBuf = Buffer.from(await ovRes.arrayBuffer());
39  var ov = await loadImage(ovBuf);
40
41  var canvas = createCanvas(base.width, base.height);
42  var ctx = canvas.getContext("2d");
43  ctx.imageSmoothingEnabled = true;
44  ctx.imageSmoothingQuality = 'high';
45
46  ctx.drawImage(base, 0, 0, base.width, base.height);
47
48  var sx = base.width / 1280, sy = base.height / 1283;
49  var tx = bx * sx, ty = by * sy, tw = bw * sx, th = bh * sy;
50
51  var ovRatio = ov.width / ov.height;
52  var boxRatio = tw / th;
53
54  var cx, cy, cw, ch;
55  if (ovRatio > boxRatio) {
56    ch = ov.height;
57    cw = ch * boxRatio;
58    cx = (ov.width - cw) / 2;
59    cy = 0;
60  } else {
61    cw = ov.width;
62    ch = cw / boxRatio;
63    cx = 0;
64    cy = (ov.height - ch) / 2;
65  }
66
67  ctx.drawImage(ov, cx, cy, cw, ch, tx, ty, tw, th);
68
69  var png = await canvas.encode('png');
70  var url = await imgbb(png);
71  return url;
72}
73
74gataulah("https://wallpaperswide.com/download/the_host-wallpaper-1280x720.jpg").then(console.log);
raw