Skip to content

Commit af73617

Browse files
committed
Update the readme about the BPG encoding usage, install and licence
1 parent fa0b7bb commit af73617

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
This is a [SDWebImage](https://github.com/SDWebImage/SDWebImage) coder plugin to add [BPG Image Format](https://bellard.org/bpg/) support. Which is built based on the open-sourced [libbpg](https://github.com/mirrorer/libbpg) codec.
1212

13-
This BPG coder plugin currently support static BPG and animated BPG image decoding.
13+
This BPG coder plugin support static BPG and animated BPG image decoding. It also include an optional codec based on the `bpgenc` to support static BPG and animated BPG encoding.
1414

1515
## Requirements
1616

@@ -30,10 +30,28 @@ it, simply add the following line to your Podfile:
3030
pod 'SDWebImageBPGCoder'
3131
```
3232

33+
SDWebImageBPGCoder contains subspecs `libbpg` & `bpgenc`. Which integrate the codec plugin for libbpg and custom bpgenc to support BPG image decoding/encoding.
34+
35+
To enable BPG decoding, you should add `libbpg` subspec:
36+
37+
```ruby
38+
pod 'SDWebImageBPGCoder/libbpg'
39+
```
40+
41+
To enable BPG encoding, you should add `bpgenc` subspec:
42+
43+
```ruby
44+
pod 'SDWebImageBPGCoder/bpgenc'
45+
```
46+
47+
By default will contains only `libbpg` subspec for most people's usage. Using `bpgenc` encoding subspec only if you want BPG encoding.
48+
3349
#### Carthage
3450

3551
SDWebImageBPGCoder is available through [Carthage](https://github.com/Carthage/Carthage). Which use libbpg as dynamic framework.
3652

53+
Carthage does not support like CocoaPods' subspec, since most of user use BPG decoding without x265 library. The framework through Carthage only supports libbpg for BPG decoding.
54+
3755
```
3856
github "SDWebImage/SDWebImageBPGCoder"
3957
```
@@ -60,6 +78,22 @@ let imageView: UIImageView
6078
imageView.sd_setImage(with: url)
6179
```
6280

81+
`SDWebImageBPGCoder` also support BPG encoding (need bpgenc subspec). You can encode `UIImage` to BPG compressed image data.
82+
83+
+ Objective-C
84+
85+
```objectivec
86+
UIImage *image;
87+
NSData *imageData = [image sd_imageDataAsFormat:SDImageFormatBPG];
88+
```
89+
90+
+ Swift
91+
92+
```swift
93+
let image;
94+
let imageData = image.sd_imageData(as: .BPG)
95+
```
96+
6397
## Screenshot
6498

6599
<img src="https://raw.githubusercontent.com/SDWebImage/SDWebImageBPGCoder/master/Example/Screenshot/BPGDemo.png" width="300" />
@@ -78,4 +112,6 @@ DreamPiggy
78112

79113
SDWebImageBPGCoder is available under the MIT license. See the LICENSE file for more info.
80114

115+
However, when using `bpgenc`, the license will be subject to GPL licence (or commercial licence if you have one). Because we use x265, and use a modified version of `bpgenc` (which is GPL). Check [x265.org](http://x265.org/) and [libbpg](https://github.com/mirrorer/libbpg) for more information.
116+
81117

0 commit comments

Comments
 (0)