image-color-analyst 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +20 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -20,4 +20,23 @@ A Node.js package to analyze images and extract dominant colors, color palettes,
20
20
  npm install -g image-color-analyzer
21
21
 
22
22
  # Install as dependency for your project
23
- npm install image-color-analyzer
23
+ npm install image-color-analyzer
24
+
25
+ # Example
26
+ const multer = require("multer");
27
+ const { analyze } = require("image-color-analyst");
28
+
29
+ const app = express();
30
+ const upload = multer({ dest: "uploads/" });
31
+
32
+ app.post("/analyze", upload.single("image"), async (req, res) => {
33
+ try {
34
+ const result = await analyze(req.file.path, {
35
+ topColorsCount: 5,
36
+ });
37
+
38
+ res.json({ success: true, data: result });
39
+ } catch (e) {
40
+ res.status(500).json({ success: false, error: e.message });
41
+ }
42
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "image-color-analyst",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Analyze images to find dominant colors and color distribution",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",