Giter Club home page Giter Club logo

img-halftone's Introduction

img-tissue

<img-halftone>

A web component turns <img> into halftone.๐Ÿฅ‘

GitHub npm npm npm bundle size

Features

  • ๐ŸŽจ Print halftone image with CMYK.
  • โš™๏ธ Halftone is performed in web worker.
  • ๐Ÿ“œ Render with Canvas or HTML element.
  • ๐Ÿงฉ Various dot shapes supported.
  • ๐Ÿ”– Alt support for Accessibility.
  • ๐Ÿ›Ž A loading className on the host.
  • ๐Ÿ’ฝ โ‰ˆ 3kB minzipped.

Demo

Description Live demo
Default setting with a zoom-in-out animation codepen
Render with different varient codepen
Render with different cellsize codepen
Render with different shape codepen
Concurrent processing codepen

Usage

Install

npm install @9am/img-halftone
import '@9am/img-halftone'

Or use a CDN link

<script type="module" src="https://cdn.skypack.dev/@9am/img-halftone"></script>
<script src="https://www.unpkg.com/@9am/img-halftone"></script>

HTML

<img-halftone src="img.png"></img-halftone>

Documentation

<img-halftone> attributes

Name Type Default Description
src {string} Required The image URL
alt {string} img-halftone The alternative text description
varient {canvas | grid} canvas The Render type
(Notice: using 'grid' with small cellsize will cause layout performance problem.)
cellsize {number} 4 The cell size for each dot in pixel
shape {circle | triangle | rectangle | hexagon } circle The shape of dots

License

MIT

img-halftone's People

Contributors

9am avatar

Stargazers

 avatar

Watchers

 avatar  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.