GithubHelp home page GithubHelp logo

blurhash-server's Introduction

blurhash-server

Scroll down for Englist version of README.

blurhash-server 是一个使用 facil.io 构建的 blurhash HTTP服务器。 该项目支持容器化(containerlize),且容器大小不到 10MB 。

blurhash 是一个用于将图片转化成 blurhash string 的工具。 blurhash string 是一个可被存储在数据库中的字符串,也可以被转化成原图被模糊(blur)后的图像。 多用于应用程序需要精美图像,但不得不等待资源服务器响应时,作为图像占位符使用。更多详情可关注 blurha.sh

编译依赖

  • Meson: 一个很优秀的high-level编译系统
  • Make: GNU Make
  • Ninja: 一个小且关注速度的编译系统

可选依赖

  • Docker: 容器系统,用于容器化(containerlize)

使用

克隆仓库并进入

git clone https://github.com/zaiic/blurhash-server.git
cd blurhash-server

直接运行

make run

仅编译

make build # 可执行文件在build目录中

容器化

sudo make containerlize # Docker容器化需要root权限

示例

git clone https://github.com/zaiic/blurhash-server.git
cd blurhash-server
make run

在另一个终端中:

curl -sS -F 'data=@/home/zaiic/Pictures/Wallpapers/night.png' http://localhost:3000/blurhash

返回json数据:

{"blurhash":"TP9a%;abNEEGj^t9R1WUbc%5j=W9"}

blurhash-server

blurhash-server is a blurhash HTTP Server built by facil.io. And it support containerlization, and its size is less than 10MB.

blurhash is a tool to convert an image file into blurhash string. blurhash string could be stored in the database and could be converted back to a blurred image. Usually, it is used as an image placeholder when the application needs exquisite images but has to wait for the response from the resource server. Learn more blurha.sh.

Compiling Dependencies

  • Meson: An awesome high-level build system
  • Make: GNU Make
  • Ninja: Ninja is a small build system with a focus on speed

Optional Dependency

  • Docker: A container system using for containerlization

Usage

Clone The Repository and Change Directory

git clone https://github.com/zaiic/blurhash-server.git
cd blurhash-server

Directly Run

make run

Only Compile

make build # the executable is in the folder build.

Containerlize

sudo make containerlize # Docker needs root privilege for containerlization

Example

git clone https://github.com/zaiic/blurhash-server.git
cd blurhash-server
make run

In another terminal:

curl -sS -F 'data=@/home/zaiic/Pictures/Wallpapers/night.png' http://localhost:3000/blurhash

Returned json data:

{"blurhash":"TP9a%;abNEEGj^t9R1WUbc%5j=W9"}

blurhash-server's People

Contributors

mistgc avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.