Update README.

Check bit depth when saving image as PNG.
This commit is contained in:
Syoyo Fujita 2019-03-07 20:50:58 +09:00
parent 8fd91aea04
commit e8a46c4e1d
2 changed files with 23 additions and 12 deletions

View File

@ -7,6 +7,8 @@ If you are looking for old, C++03 version, please use `devel-picojson` branch.
## Status
v2.2.0 release(Support loading 16bit PNG)
v2.1.0 release(Draco support)
v2.0.0 release(22 Aug, 2018)!
## Builds
@ -38,14 +40,15 @@ v2.0.0 release(22 Aug, 2018)!
* Image(Using stb_image)
* [x] Parse BASE64 encoded embedded image data(DataURI).
* [x] Load external image file.
* [x] PNG(8bit only)
* [x] JPEG(8bit only)
* [x] BMP
* [x] GIF
* [x] Load PNG(8bit and 16bit)
* [x] Load JPEG(8bit only)
* [x] Load BMP
* [x] Load GIF
* [x] Custom Image decoder callback(e.g. for decoding OpenEXR image)
* Load from memory
* Custom callback handler
* [x] Image load
* [x] Image save
* Extensions
* [x] Draco mesh decoding
@ -69,9 +72,11 @@ v2.0.0 release(22 Aug, 2018)!
* [ ] Mesh Compression/decompression(Open3DGC, etc)
* [x] Load Draco compressed mesh
* [x] Save Draco compressed mesh
* [ ] Open3DGC?
* [ ] Support `extensions` and `extras` property
* [ ] HDR image?
* [ ] OpenEXR extension through TinyEXR.
* [ ] 16bit PNG support in Serialization
* [ ] Write example and tests for `animation` and `skin`
* [ ] Skinning
* [ ] Morph targets

View File

@ -26,6 +26,7 @@
// THE SOFTWARE.
// Version:
// - v2.2.0 Add loading 16bit PNG support.
// - v2.1.0 Add draco compression.
// - v2.0.1 Add comparsion feature(Thanks to @Selmar).
// - v2.0.0 glTF 2.0!.
@ -1772,6 +1773,11 @@ bool WriteImageData(const std::string *basepath, const std::string *filename,
std::vector<unsigned char> data;
if (ext == "png") {
if ((image->bits != 8) || (image->pixel_type != TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE)) {
// Unsupported pixel format
return false;
}
if (!stbi_write_png_to_func(WriteToMemory_stbi, &data, image->width,
image->height, image->component,
&image->image[0], 0)) {