1
- BPG Image Encoder and Decoder
2
- -----------------------------
1
+ BPG Image library and utilities
2
+ -------------------------------
3
3
4
4
1) Quick introduction
5
5
---------------------
@@ -14,6 +14,9 @@ BPG Image Encoder and Decoder
14
14
and does not support monochrome encoding yet (hence no alpha nor
15
15
grayscale images can be encoded with it).
16
16
17
+ - bpgview: in order to compile it you need to install the SDL and
18
+ SDL_image libraries.
19
+
17
20
- Emscripten usage: in order to generate the Javascript decoder, you
18
21
must install Emscripten and enable its use in the Makefile.
19
22
@@ -72,8 +75,7 @@ as input.
72
75
* For JPEG input, the color space of the input image is not
73
76
modified (it is YCbCr, RGB, YCbCrK or CMYK). The chroma is
74
77
subsampled according to the preferred chroma format ('-f'
75
- option). Images with vertically subsampled chroma are currently
76
- not supported.
78
+ option).
77
79
78
80
* For PNG input, the input image is converted to the preferred
79
81
color space ('-c' option). Its chroma is then subsampled
@@ -87,6 +89,38 @@ as input.
87
89
of a loss in the color components. This loss is not an issue if the
88
90
image is not edited.
89
91
92
+ - Animations: with the '-a' option, animations can be encoded from a
93
+ sequence of PNG or JPEG images, indexed from 1 or 0. For example:
94
+
95
+ ./bpgenc -a anim%2d.png -fps 25 -loop 0 -o anim.bpg
96
+
97
+ generates an animation from anim01.png, anim02.png, etc... The frame
98
+ rate is specified with '-fps' and the number of loops with '-loop'
99
+ (0 = infinite). If a different delay per image is needed as in some
100
+ animated GIFs, a text file can be specified with the '-delayfile'
101
+ option. It contains one number per image giving its duration in
102
+ centiseconds. All durations are rounded to a multiple of '1/fps', so
103
+ it is important to set a consistent frame rate.
104
+
105
+ The necessary frames and delay file can be generated from animated
106
+ GIFs with the ImageMagick tools:
107
+
108
+ convert -coalesce anim.gif anim%d.png
109
+
110
+ identify -format "%T\n" anim.gif > anim.txt
111
+
112
+ In order to reduce the file size, the frame rate can be choosen so
113
+ that most frames have a frame period of 1 (hence if anim.txt
114
+ contains only frame durations of 5 centiseconds, then choose a frame
115
+ rate of 20 frames/s).
116
+
117
+ As GIFs use paletted colors and 1 bit transparency, it is always
118
+ better to start from the source material (e.g. PNG files) to have
119
+ the best quality.
120
+
121
+ A BPG decoder not supporting animations only displays the first
122
+ frame.
123
+
90
124
- By default, bpgenc does not copy the metadata. You can copy them
91
125
with the '-keepmetadata' option. For JPEG input, EXIF, ICCP and XMP
92
126
are copied. For PNG input, ICCP is copied.
@@ -107,7 +141,15 @@ no decoded image is output).
107
141
- The '-b' option selects the bit depth (8 or 16) of the PNG
108
142
output. It is independent of the internal BPG bit depth.
109
143
110
- 4) BPG decoding library
144
+ 4) BPG viewer
145
+ -------------
146
+
147
+ The BPG image viewer uses the SDL library to display BPG images and
148
+ other image formats supported by the SDL_image library. The available
149
+ keys are displayed by launching bpgview without parameters. bpgview
150
+ supports BPG animations.
151
+
152
+ 5) BPG decoding library
111
153
-----------------------
112
154
113
155
BPG images can be decoded in any program with the libbpg
@@ -119,13 +161,19 @@ provided as a static one.
119
161
Currently there is no similar library for encoding so you should
120
162
invoke the bpgenc utility.
121
163
122
- 5 ) Javascript decoder
164
+ 6 ) Javascript decoder
123
165
---------------------
124
166
125
- bpgdec.js is a Javascript decoder supporting the BPG file
126
- format. bpgdec8b.js is a specialized version limited to BPG images
127
- using 8 bits per component. It is a little faster and consumes less
128
- memory (16 MB instead of 32 MB by default, you can change the memory
167
+ The following Javascript decoders are available, sorted by increasing size:
168
+
169
+ > 8 bits animations
170
+ bpgdec8.js no no
171
+ bpgdec.js yes no
172
+ bpgdec8a.js no yes
173
+
174
+
175
+ The 8 bit only decoders are a little faster and consumes less memory
176
+ (16 MB instead of 32 MB by default, you can change the memory
129
177
configuration in the Makefile if you want to handle larger images).
130
178
131
179
The Javascript decoder substitutes all the <img> tags with a source
@@ -138,10 +186,14 @@ The image data is downloaded with the XMLHttpRequest object. So the
138
186
BPG images and the BPG Javascript decoder must be in the same domain
139
187
unless Cross-Origin Resource Sharing is used.
140
188
189
+ When animations are displayed, all the frames are stored in memory, so
190
+ animations with a large number of frames and large resolutions should
191
+ be avoided, as with animated GIFs.
192
+
141
193
asm.js gives an interesting speed boost, so we hope that more browsers
142
194
will support this Javascript subset.
143
195
144
- 6 ) FFmpeg modifications
196
+ 7 ) FFmpeg modifications
145
197
-----------------------
146
198
147
199
- Completed support of chroma_format_idc = 0 (monochrome mode).
@@ -156,7 +208,7 @@ will support this Javascript subset.
156
208
14 are supported without code duplication but slower decoding.
157
209
158
210
- Added a modified SPS header to reduce the size of the BPG decoder
159
- (the solution instead is to generate standard VPS and SPS headers
211
+ (an alternate solution is to generate standard VPS and SPS headers
160
212
from the BPG header).
161
213
162
214
- Added defines to keep only the HEVC intra code and suppress the
@@ -165,10 +217,10 @@ will support this Javascript subset.
165
217
- Stripped FFmpeg from all codecs except HEVC and the necessary
166
218
support code.
167
219
168
- 7 ) Licensing
220
+ 8 ) Licensing
169
221
------------
170
222
171
- - libbpg and bpgenc are released under the LGPL license (the FFmpeg
223
+ - libbpg and bpgdec are released under the LGPL license (the FFmpeg
172
224
part is under the LGPL, the BPG specific part is released under the
173
225
BSD license).
174
226
0 commit comments