Participant
May 25, 2024
Create Document endpoint - file size
- May 25, 2024
- 1 reply
- 399 views
Hi,
I am using the create document endpoint to pass in 6 images of size ~400 kb each and the psd file I get back is about 34 mb.
Any ideas why this is happening and how can I control it? I tried to read the documentation and searched the internet but found nothing that could help me.
My function to create psd is as follows. Width is always 1920, height is 1000 and resolution is 72
I have also attached my input files and the resulting psd
async function createPsdWithMultipleLayers(srcUrls, headers, outputUrl, width, height) {
try {
const api_url = 'https://image.adobe.io/pie/psdService/documentCreate';
const inputs = srcUrls.map((url, index) => ({
type: "layer",
input: {
storage: "external",
href: url
},
name: `Layer ${index + 1}`
}));
const payload = {
options: {
document: {
height: height, // Use received height
width: width, // Use received width
resolution: 72,
fill: "transparent",
mode: "rgb"
},
layers: inputs
},
outputs: [{
href: outputUrl,
storage: "external",
type: "image/vnd.adobe.photoshop",
overwrite: true
}]
};
console.log("Final payload to Adobe API:", JSON.stringify(payload));
console.log("Headers for Adobe API call:", JSON.stringify(headers));
const response = await axios.post(api_url, payload, { headers: headers });
console.log("Status from Adobe API:", response.status);
console.log("inFunction: Response from Adobe API:", JSON.stringify(response.data));
return response.data;
} catch (error) {
console.error('Error creating PSD with layers:', error);
throw new Error('Error creating PSD with layers');
}
}
Any help would be much appreciated.
Thanks
