Skip to content

Commit

Permalink
Adobe Photoshop API
Browse files Browse the repository at this point in the history
  • Loading branch information
sreevidya-16 authored Aug 9, 2024
1 parent 6a8ccdb commit 868e66d
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 0 deletions.
26 changes: 26 additions & 0 deletions New_APIs/Adobe Photoshop API/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Adobe Photoshop API Demo</title>
</head>
<body>
<header>
<h1>Adobe Photoshop API</h1>
</header>
<main>
<div class="upload-section">
<h2>Upload an Image</h2>
<input type="file" id="imageUpload" accept="image/*">
<button id="applyEffectButton">Apply Effect</button>
</div>
<div class="result-section">
<h2>Processed Image</h2>
<img id="resultImage" src="" alt="Processed Image">
</div>
</main>
<script src="index.js"></script>
</body>
</html>
36 changes: 36 additions & 0 deletions New_APIs/Adobe Photoshop API/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
document.getElementById('applyEffectButton').addEventListener('click', applyEffect);

const apiKey = 'YOUR_ADOBE_API_KEY'; // Replace with your Adobe Photoshop API key

async function applyEffect() {
const imageUpload = document.getElementById('imageUpload').files[0];

if (!imageUpload) {
alert('Please upload an image.');
return;
}

const formData = new FormData();
formData.append('image', imageUpload);

try {
const response = await fetch('https://image.adobe.io/pie/psdService/photoshop?job=simple-filter-job', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'x-api-key': apiKey
},
body: formData
});

if (response.ok) {
const result = await response.json();
document.getElementById('resultImage').src = result.output.imageUrl; // Assuming the API returns the processed image URL
} else {
alert('Failed to process the image.');
}
} catch (error) {
console.error('Error:', error);
alert('Error processing the image.');
}
}
13 changes: 13 additions & 0 deletions New_APIs/Adobe Photoshop API/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions New_APIs/Adobe Photoshop API/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "adobe-photoshop-api-demo",
"version": "1.0.0",
"description": "A simple app to demonstrate the Adobe Photoshop API",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"author": "Your Name",
"license": "ISC",
"dependencies": {
"adobe-photoshop-api-demo": "file:",
"express": "^4.17.1"
}
}
8 changes: 8 additions & 0 deletions New_APIs/Adobe Photoshop API/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const express = require('express');
const app = express();

app.use(express.static('public'));

app.listen(3000, () => {
console.log('Server is running on port 3000');
});
71 changes: 71 additions & 0 deletions New_APIs/Adobe Photoshop API/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #6a11cb, #de3434);
color: #fff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}

header {
text-align: center;
margin-bottom: 20px;
}

header h1 {
font-size: 3em;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

main {
width: 90%;
max-width: 600px;
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
padding: 20px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.upload-section,
.result-section {
margin-bottom: 20px;
text-align: center;
}

input[type="file"] {
display: block;
margin: 0 auto 15px auto;
font-size: 1em;
border: none;
border-radius: 5px;
outline: none;
padding: 10px;
width: 80%;
max-width: 400px;
}

button {
padding: 10px 20px;
font-size: 1em;
background-color: #444;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}

button:hover {
background-color: #666;
}

.result-section img {
width: 100%;
max-width: 500px;
border-radius: 10px;
margin-top: 15px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

0 comments on commit 868e66d

Please sign in to comment.