AI Picture Upscaler

ÜCRETSİZ PREMIUM
Taraf Firdavs Shodiyev | Güncelleyen 2 महीने पहले | Artificial Intelligence/Machine Learning
Popülerlik

9.4 / 10

Gecikme

9,519ms

Hizmet Düzeyi

92%

Health Check

100%

Tüm Tartışmalara Dön

Problem in saving response as image file

Rapid account: Sanjaysinghg 2 U
sanjaysinghg2u
5 महीने पहले

This is NodeJS Code

I want to save response as image file

const axios = require(‘axios’);
const fs = require(‘fs’);
const FormData = require(‘form-data’);

async function run() {
const data = new FormData();
data.append(‘image’, fs.createReadStream(‘image1.jpg’));
data.append(‘sizeFactor’, ‘2’);
data.append(‘imageStyle’, ‘default’);
data.append(‘noiseCancellationFactor’, ‘0’);

const options = {
    method: 'POST',
    url: 'https://ai-picture-upscaler.p.rapidapi.com/supersize-image',
    headers: {
        'X-RapidAPI-Key': 'API KEY',
        'X-RapidAPI-Host': 'ai-picture-upscaler.p.rapidapi.com',
        ...data.getHeaders(),
        responseType: 'arraybuffer',

    },
    data: data
};

try {
    console.log("Processing");

    const response = await axios.request(options);
    // console.log(typeof (response.data));
    const imageData = Buffer.from(response.data);

} catch (error) {
    console.error(error);
}

}

run()

Aşağıya yorum ekleyerek tartışmaya katılın:

Yeni yorumlar göndermek için giriş yapın / kaydolun