Skip to main content
Participant
April 5, 2023
Question

Facing problem to upload Images in photoshop api(Auto tone)

  • April 5, 2023
  • 2 replies
  • 967 views

Hello,

I am trying to implement Photoshop Api(Auto tone feature) for last few days in my React Js App. I have implemented the api following the docs, I still I dont understand that how to input/upload a image to the api and get the processed image successfully. I just want to know the full procedure. The documentation seems hard to understand.

Thanks

This topic has been closed for replies.

2 replies

Participant
May 22, 2023

If you are facing problems uploading images in the Photoshop API for auto tone:

  1. Verify that the image format is supported by the API (JPEG, PNG, etc.) and check for any file size limitations.
  2. Ensure that the API request and authentication parameters are correctly set up, including the correct endpoint and necessary headers.
  3. If the issue persists, consult the Adobe Developer Community or reach out to Adobe's technical support for further assistance in troubleshooting the image upload problem.
  4. https://apotekforalla.com/
Community Manager
April 11, 2023

Hi! 

I am sorry to hear you are having trouble with the API. I noticed you used a lot of tags in your post so I am not sure what product you are referring to. I am guessing you are using the API found at https://developer.adobe.com/photoshop/api/?

If this is the case the correct tag would be Ps Automation API and I am the perfect person to help! 

Would you confirm what product you are using and if possible share the code payload you are sending? 

Participant
April 14, 2023

Hello,
I am using this api in React Js-

https://image.adobe.io/lrService/autoTone

I have implemented the api to get the job id.. and using this api to get the results
https://image.adobe.io/sensei/status/{jobId}
But I am not getting proper results . Instead I am getting the below..I am not sure I am giving input properly

I am not understanding the docs properly to input the images. I am also not understanding the below fields

I want to apply this auto tone api in my app..so that user can simply upload their image click a button and get the edited image..thats it. But I am not able to do it. Can you please help me to complete this api functionality?
Another query is that the access token i get from the project console it expires after two days. Why it happens? It should not expire right? If it expires continously after two days then how we use your api in our apps?

Participant
April 15, 2023
const AWS = require('aws-sdk');
const axios = require('axios');
const fs = require("fs");


exports.createImage = async (req, res) => {
// AWS S3 credentials
const s3 = new AWS.S3({
  accessKeyId: 'id key',
  secretAccessKey: 'access key',
  region: 'us-example'
});

// Adobe Lightroom API credentials
const token = 'eyJhbGciOiJSUzI1NiIsIng1dSI6Imltc19uYTEta2V5LWF0LTEuY2VyIiwia2lkIjoiaW1zX25hMS1rZXktYXQtMg';
const apiKey = 'api key';

// Image file details
const bucketName = 'adobe-image-store';
const fileName = req.filename;
const filePath = `public/${fileName}`;
const s3StorageUrl = `s3://${bucketName}/${fileName}`;

// AWS S3 upload
const s3UploadParams = {
  Bucket: bucketName,
  Key: fileName,
  Body: fs.readFileSync(filePath)
};

s3.upload(s3UploadParams, (err, data) => {
  if (err) {
    console.log('Error uploading image to S3:', err);
    return;
  }
  console.log('Image uploaded to S3 successfully:', data);

  let imgUrl = data.Location ;

  console.log(" image url : " + imgUrl)

  // Adobe Lightroom API call to apply auto tone effect

  const headers = {
    Authorization: `Bearer ${token}`,
    'x-api-key': apiKey,
    'Content-Type': 'application/json',
  };

  const data1 = {
    inputs: {
      href: imgUrl,
      storage: 'external',
    },
    outputs: [
      {
        href: imgUrl,
        type: 'image/png',
        storage: 'external',
        overwrite: true,
      },
    ],
  };

  let jsonContent = JSON.stringify(data1);


  axios.post(lrServiceUrl, jsonContent, { headers })
    .then(response => {
      console.log('Auto tone effect applied successfully:', response.data);
      console.log('Auto tone effect applied successfully:', response.data._links.self.href);
      axios
      .get(`${response.data._links.self.href}`, {
        headers: {
          Authorization: `Bearer ${token}`,
          "x-api-key": apiKey,
        },
      })
      .then((result) => {
      res.status(200).json({
        message: 'successfully generated image',
        result: result.data
      });

      }
      );

    })
    .catch(error => {
      console.log('Error applying auto tone effect:', error);
    });
});

}
 
 
I did the code like above , but facing same issue to get final out put