Skip to content

Commit

Permalink
refactor: refactoring of demo scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
DPende authored and VinciGit00 committed Feb 23, 2024
1 parent f6bbf1a commit e05f0dc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 54 deletions.
2 changes: 1 addition & 1 deletion demo/scripts/black_white_demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EditPix from "../../src/editpix.js";

const editpix = new EditPix();

const url = "../images/img1.jpg";
const url = "images/img1.jpg";

var image = new Image();
image.src = url;
Expand Down
4 changes: 2 additions & 2 deletions demo/scripts/color_palette_demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EditPix from "../../src/editpix.js";

const editpix = new EditPix();

const url = "../images/img1.jpg";
const url = "images/img1.jpg";

var image = new Image();
image.src = url;
Expand All @@ -13,7 +13,7 @@ container.classList.add("container")
//waiting image load
image.onload = () => {
//calculate color palette
editpix.getColorPalette(image, 15,9)
editpix.getColorPalette(image, 15, 1)
.then(colorPalette => {
//log color palette in rbg format
displayPalette(colorPalette);
Expand Down
2 changes: 1 addition & 1 deletion demo/scripts/dominant_color_demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EditPix from "../../src/editpix.js";

const editpix = new EditPix();

const url = "../images/img1.jpg";
const url = "images/img1.jpg";

var image = new Image();
image.src = url;
Expand Down
2 changes: 1 addition & 1 deletion demo/scripts/gray_scale_demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EditPix from "../../src/editpix.js";

const editpix = new EditPix();

const url = "../images/img1.jpg";
const url = "images/img1.jpg";

var image = new Image();
image.src = url;
Expand Down
9 changes: 7 additions & 2 deletions demo/scripts/resize_image_demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EditPix from "../../src/editpix.js";

const editpix = new EditPix();

const url = "../images/img3.jpeg";
const url = "images/img3.jpeg";

var image = new Image();
image.src = url;
Expand All @@ -17,25 +17,30 @@ image.onload = () => {
// image dimension before resizing
console.log("Dimension before resizing: " + image.naturalWidth + "x" + image.naturalHeight);

document.body.appendChild(image)

// resize image by quality
editpix.resizeByQuality(image, 10)
editpix.resizeByQuality(image, 8)
.then(resizedImage => {
// image dimension after resizing
console.log("Dimension after resizing by 90%: " + resizedImage.naturalWidth + "x" + resizedImage.naturalHeight);
document.body.appendChild(resizedImage)
})
.catch(error => { console.log(error) })

// resize image by width
editpix.resizeByWidth(image, 100)
.then(resizedImage => {
console.log("Dimension after resizing width equals to 100px: " + resizedImage.naturalWidth + "x" + resizedImage.naturalHeight);
document.body.appendChild(resizedImage)
})
.catch(error => { console.log(error) })

// resize image by width
editpix.resizeByHeight(image, 100)
.then(resizedImage => {
console.log("Dimension after resizing height equals to 100px: " + resizedImage.naturalWidth + "x" + resizedImage.naturalHeight);
document.body.appendChild(resizedImage)
})
.catch(error => { console.log(error) })
};
20 changes: 0 additions & 20 deletions src/core/decript.js

This file was deleted.

27 changes: 0 additions & 27 deletions src/core/encript.js

This file was deleted.

0 comments on commit e05f0dc

Please sign in to comment.