Skip to content

Commit

Permalink
docs: add document for compressed writer
Browse files Browse the repository at this point in the history
  • Loading branch information
yeqown committed Sep 22, 2022
1 parent f2f14f2 commit 412857d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ following are some shots:

- [Standard Writer](./writer/standard/README.md), prints QRCode into file and stream
- [Terminal Writer](./writer/terminal/README.md), prints QRCode into terminal
- [Compressed Writer](./writer/compressed/README.md), It's generated on a very small scale

Of course, you can also code your own writer, just implement [Writer](./writer/README.md) interface.

Expand Down
27 changes: 27 additions & 0 deletions writer/compressed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Compressed Writer

[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/yeqown/go-qrcode/writer/compressed)

Compressed Writer is a writer that is used to draw QR Code image on a very small scale.
Since the compressed writer would only use a two-tone palette to generate the image,
and automatically compressed in PNG format.

Check codes for more details about compress principle.

### Usage

```go
option := compressed.Option{
Padding: 4, // padding pixels around the qr code.
BlockSize: 1, // block pixels which represents a bit data.
}

w, err := compressed.New(name, &option)
if err != nil {
panic(err)
}

if err := qrc.Save(w); err != nil {
panic(err)
}
```

0 comments on commit 412857d

Please sign in to comment.