This project provides two methods to generate BlurHash from images:
- CLI (index.js) → Generates BlurHash directly from the terminal.
- Web UI & API (server.js) → Express-based server to upload images and get BlurHash results via API or web interface.
Make sure Node.js is installed on your system, then run:
npm install
Use the CLI to generate BlurHash from an image:
node index.js path/to/image.jpg
Output:
- Base64 URL of the BlurHash result
- Original image size
- Converted image size in Base64
Run the server to use the web interface and API:
node server.js
The server will be available at http://localhost:3251
.
Method | Endpoint | Description |
---|---|---|
POST |
/upload |
Upload an image and receive the BlurHash result. Optional body parameters: width and height to specify the output dimensions. |
Example request (cURL):
curl -X POST -F "image=@path/to/image.jpg" -F "width=300" -F "height=400" http://localhost:3251/upload
Response JSON:
{
"originalSize": "200 KB",
"processedSize": "50 KB",
"base64Url": "data:image/jpeg;base64,/9j/4AAQSk..."
}
To run the project using Docker, use the following commands:
docker build -t blurhash-generator .
docker run -p 3251:3251 blurhash-generator
- Node.js
- Express.js
- Sharp (Image Processing)
- Multer (File Upload)
- BlurHash (Image Hashing)
This project is licensed under the MIT license.
💡 Created with ❤️ by Yuke Brilliant Hestiavin