File size: 579 Bytes
a2b2aac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import cheerio from 'cheerio';
import got from 'got';
import axios from 'axios' 
import Form from 'form-data';
import { z } from 'zod';

async function enhanceImg(url, scale) {
  const scaleNumber = scale ? scale : 2
  const { data } = await axios(`https://toolsapi.spyne.ai/api/forward`, {
    method: "post",
    data: {
      image_url: url,
      scale: scaleNumber,
      save_params: {
        extension: ".png",
        quality: 95
      }
    },
    headers: {
      "content-type": "application/json",
      accept: "*/*"
    }
  })
  return data
}
export { enhanceImg }