Fast libspng-based PNG decoder. Fork of pyspng.
Project description
Note: This is a fork of pyspng which can be found here: https://github.com/nurpax/pyspng/. See below for a list of differences.
Pyspng is a small library to for efficiently loading PNG files to numpy arrays. Pyspng does not offer any image manipulation functionality.
Pyspng was originally written to speed up loading uncompressed (PNG compression level 0), making the PNG file format more suitable to be used in machine learning datasets. Pyspng uses the native libspng library for fast PNG decoding. Synthetic benchmarks indicate pyspng to be roughly 2-3x faster in loading uncompressed PNGs than the Python Pillow library.
Scripting Example
import numpy as np
import pyspng
from pyspng import ProgressiveMode
# DECODING
with open('test.png', 'rb') as fin:
nparr = pyspng.load(fin.read())
# ENCODING
binary = pyspng.encode(
nparr,
# Options: NONE (0), PROGRESSIVE (1), INTERLACED (2)
progressive=ProgressiveMode.PROGRESSIVE,
compress_level=6
)
with open('test.png', 'wb') as fout:
fout.write(binary)
CLI Example
There is a CLI included with this distribution.
# turn a numpy file into a highly compressed progressive PNG
pyspng example.npy --level 9 --progressive # -> example.png
# create a highly compressed progressive interlaced PNG
pyspng example.npy --level 9 --interlaced # -> example.png
# convert a PNG into a numpy file example.npy
pyspng -d example.png
# read header
pyspng --header example.png
Installation
pip install pyspng-seunglab
Binary wheels are built for Linux, MacOS, and Windows. This library is intended to be a drop-in replacement for pyspng, so simultaneous installations are not possible. If this is inconvinient, we can adjust this.
Differences from pyspng
- Compiles on MacOS
- Upgrades spng to 0.7.2
- Fixes a bug for decoding grayscale with alpha
- Adds an encoder function (new in libspng)
- Replaces zlib with miniz-2.2.0 for simplicity.
- Adds CLI for compressing/decompressing npy files.
- Adds function for examining PNG headers.
License
pyspng and pyspng-seunglab are provided under a BSD-style license that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pyspng_seunglab-1.1.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8649d53c3231403c8605afd38059ebe3b9365be95912bca377dc2a10d95ecab |
|
MD5 | 7a886419cce149ae2cbe8e045c130273 |
|
BLAKE2b-256 | d39401294658513f234fdbbdb28f8ca9da8ea89749896a886cb13db78cd0407e |
Hashes for pyspng_seunglab-1.1.0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a88989fbc39f47e1d4cdd21112dd84a48e4378a6eac7657de4c0ace626ee8e54 |
|
MD5 | 4de1369f4e6de54ee0fa6283e8f4b092 |
|
BLAKE2b-256 | 91576a4bd1196931ade06b29237bc5f2e86049377a7c91c770611c844032de61 |
Hashes for pyspng_seunglab-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c01fe2ac1050f1d9aeb7261107e62615e9cc1cfb1c911bfff69811b26c964a9 |
|
MD5 | 8f62eed39e80fa10c3081913665ddfd8 |
|
BLAKE2b-256 | 2727fd59b56c683be67da85768045ce36fc7e25042a6d56a57cec03a475e9730 |
Hashes for pyspng_seunglab-1.1.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c62b1284d91f77660e91a64b4eb1289c404a2d3ceaeb105c51c6eb3e8f805eb0 |
|
MD5 | b154bfe47c43e649fe7d8cfe83bdb7d9 |
|
BLAKE2b-256 | bdf79d4211bb84432ae03821c08765878facaffb5737b1f9254840a59af1d005 |
Hashes for pyspng_seunglab-1.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2adcda9675ed584caa3985bac15a3d9e3ec078d87eda65a319daef0facf1e99e |
|
MD5 | 6d35e298fd842a5d2e6bb59e92a61b16 |
|
BLAKE2b-256 | f52c51d94b4a72f0da02110518ed4c19e39d0cf048884f031b70bff3befd642d |
Hashes for pyspng_seunglab-1.1.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cacb4de9978ee679df1d8f170fb1d34f20e78dd933b27887d0cbcaa43a8dcbf |
|
MD5 | 4582fb77d021315dbc94e377fcf375e9 |
|
BLAKE2b-256 | 408c907fa83ce5b9bc9843eee355bbd14524971313814257323b9c8a4575ce0c |
Hashes for pyspng_seunglab-1.1.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ce158ff39b0f19b92f861e46913d18a3524465a342a9ace7b4c08683cee473c |
|
MD5 | 7e90e23d7d00c6a6af7d3242a132c9aa |
|
BLAKE2b-256 | 95645bec8044be62b0e5839a0608ad3716627522e6dd6183758fcedc5a48a65f |
Hashes for pyspng_seunglab-1.1.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 738b3105b14101d1e836041603e14ba488e8f58ca2cf28b7dbddc590c1f3eb25 |
|
MD5 | 2044fe1070424f4d9402a14e61d0980d |
|
BLAKE2b-256 | 31b9980f0c559cf0507a9b43dabba0d615e9ef88bdbb0a7686dc0962b8082fbd |
Hashes for pyspng_seunglab-1.1.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 257f4fbfb0f83e567fb9ab895ad9e7a52b08c44fbde7dd200a5246c833f8c68e |
|
MD5 | 6a6e7a727ab12d26d68154981b0bd675 |
|
BLAKE2b-256 | c1797b58660e4126d0ab65b7e2ce4455b0be2af3ce89e2ba38a4f7c374ad4418 |
Hashes for pyspng_seunglab-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a91ae5a94bc528043962dca45f5a543e31117b6fb6d487f9e227950856943a5a |
|
MD5 | 8911ce68071ac37e79fd75649798e39c |
|
BLAKE2b-256 | 7874f6b90b477d4fb4d90de2021876c49bb1c6a9d54e495e6dbfa4cb62a8b2c0 |
Hashes for pyspng_seunglab-1.1.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca5bb933babc872f885ddc8a284420ed87788569038d6a621b830a1d64ced333 |
|
MD5 | d0deadcdcee2ecb687042ee09b80a5ac |
|
BLAKE2b-256 | 4ce39cd290f7d035b81079c6432b0ee11d96316b4dec6554c7d04d5cbc322377 |
Hashes for pyspng_seunglab-1.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e1425a1ce21ca242b2a8042fcc3e5a28bcb98b7d92c3567dfeb9cfd93135012 |
|
MD5 | c488c6bd3275a6502b7eb8c611d77a24 |
|
BLAKE2b-256 | 9e459e3a0ba60e56ae3ce9fdc288082165869ea7e775524f1af7aac43874b6bd |
Hashes for pyspng_seunglab-1.1.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31db81107d975bb52f74aa1d8d0a8adc8b388e4d542cdb0d79a79e717a7d5629 |
|
MD5 | d561568f95e3aac783241b7551f14910 |
|
BLAKE2b-256 | 18061f37c63f4e2f0340394a9d5bcf2acdde03f1a5f64d1655a08cbbae421dac |
Hashes for pyspng_seunglab-1.1.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dab3378f55d8deb46bf2df57651eb2c5cb4e931e2f4c91a89871c2318b6b3e8 |
|
MD5 | 79541e4f6966d041c8306c8e8c30a110 |
|
BLAKE2b-256 | bb5c2a4b68c792631097cd3f122055bb27d477299faa3055abf0bcc630331b6a |
Hashes for pyspng_seunglab-1.1.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b954fa0f14c2dbc6ea3f1b6dfa82ae6a756a22d27c5458e261bcec5863cd8c8 |
|
MD5 | ead8c10cb9951eead8cab00f1c6ee728 |
|
BLAKE2b-256 | 6175ead4bc0f354867ca3fa766eeab17fd526da7a2798704bec7dd9a10e00543 |
Hashes for pyspng_seunglab-1.1.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b869ef312f033252c8c4097f13b691a51ee0a3b3ca8637786a6aec521dc2d514 |
|
MD5 | 1270ee8ac9dcb9645bf46748a21c459d |
|
BLAKE2b-256 | fe2c78f674856285163116b418cfe90a1ebcf173d1eaacacf31e7590b4c175d9 |
Hashes for pyspng_seunglab-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83eb071ef62b9fefc26824468c1cfaee9de1a3402fba2a495387b409fc4dfa2f |
|
MD5 | e299941f3b3326c0f0f713ce363fe7af |
|
BLAKE2b-256 | f2f2d517e2743b52226dd4fc8a7d349083138e34b2a34819f5d88017ee3786cf |
Hashes for pyspng_seunglab-1.1.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12a6ce7f7393cd05d8d756391fb96ca45e05c736109cd894dbe8d20cb3ce95b5 |
|
MD5 | b365fb18551d9a24d025931dd578b24b |
|
BLAKE2b-256 | 6f81955d7d46b844001f21e77c76cd17fcbddea14a364a26baa7201b9f9ab403 |
Hashes for pyspng_seunglab-1.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 557c001aea82558032fcda5a0ce3216f8d997cfc98373455adf734b81ae15e43 |
|
MD5 | 7e680c2872da9b8526820f236dfb7996 |
|
BLAKE2b-256 | 58906039b6c2a40997a68fb7e24b6075f8c90506b3bf7e5c99326d73510af4b3 |
Hashes for pyspng_seunglab-1.1.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e82037ec6c4ac6e7cb05678594fca1e915aa8c8dfcc7e8c609a9478daf15ff63 |
|
MD5 | b91ae14e6453e6ce3b2e756ece21bff5 |
|
BLAKE2b-256 | d12bd1b92617063069bf649c3aa4c24f0becad15647997bf9a1f62e019472396 |
Hashes for pyspng_seunglab-1.1.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f093a55d5f57aa2687b2b1ec83e62607e034643bf63b4c3304b87bdbb92a70ba |
|
MD5 | bf921fe5ddb4562bce21fd3a739711bf |
|
BLAKE2b-256 | bf8641e8ef0dea91c7d1c3ab703689995fe4c67daf84080b920416b94957d93e |
Hashes for pyspng_seunglab-1.1.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4563a43ac9fb33bd62bf0db6d39ff1216cad831e0de315a6be18138f7238da5 |
|
MD5 | cb56f47e273299b4a6c06837ffa6f34e |
|
BLAKE2b-256 | 0addb0e7ec5ef795f80880e785aecfb193c4891424969e73602f8ceb2913ce50 |
Hashes for pyspng_seunglab-1.1.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05e11134f493b1ac0ade1b88996cd05206844221f9428e7d4599eb73a525c24d |
|
MD5 | 5e5fbcaddb7264bdc176c9dc7aef3423 |
|
BLAKE2b-256 | 0903f73f57fadf6717ae22fd06c5aed5ce7f81c76159ecc4da589912a0a31217 |
Hashes for pyspng_seunglab-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cd52fdf6d0ac69216ee551c9642c52165b682b16c90f1616da0eacb8eefd6bc |
|
MD5 | db69edba8de86524c188500f58fcb010 |
|
BLAKE2b-256 | 11405c05e7fe7229a67fd49246e47c445aaf1eed88a85d513e082064e44bdd34 |
Hashes for pyspng_seunglab-1.1.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ddaf354d8db2f64ceb25f364f7ad5efdd3a6c3f2f1080c3a375523bcb73f794 |
|
MD5 | 4e8831ef5a793fbb753cbe8d8dcfe786 |
|
BLAKE2b-256 | 2c3fcaa0d956f4c64409baea71d42a9d390582d28b1e4bedff9706875128de4e |
Hashes for pyspng_seunglab-1.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 507171d2dc9f7f6a417a8b03e3876e0bc8e0d75ab68dfdc88d6fda5d7514acd4 |
|
MD5 | 7685bca599a69c175a8b37e54879d5b3 |
|
BLAKE2b-256 | 07bffe8b3523fbec77f44ccb97047f66e8d164f919637771696f03908f61b808 |
Hashes for pyspng_seunglab-1.1.0-cp38-cp38-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88a4f4d01817977b69cf7cc0a7ce7d25a91ec049ccf2b04cc67782296caa9ce5 |
|
MD5 | 67b958da252a4cbe28b1aef1283ee9a2 |
|
BLAKE2b-256 | 67ebeaba936453fda1fbc854607d4616571661ae28a866e23739bd26da1d8590 |
Hashes for pyspng_seunglab-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98a085bef2e6e076732790daa16ebde54007d02678c73668080ef370fd2ce564 |
|
MD5 | 91c3ae12c09eb2df0c112c3f1238b7ea |
|
BLAKE2b-256 | e5873f1b99e76fda173d682ae78a2e947f3a3e6a5fe6234e6a7b342cc3f399da |
Hashes for pyspng_seunglab-1.1.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47d9260e6275d0bbc3dcce20abde58103ab54eccea2c4d1430b86fe074c3ac88 |
|
MD5 | 1840f153203ca87a09e53df6f5a5c4b6 |
|
BLAKE2b-256 | a2602d30f1aca138e83cc90c5d9398245463bc59c12fa13e4911321ba8713ac6 |
Hashes for pyspng_seunglab-1.1.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 346cc714fa6b44f565ecb1b775c723fe9ec283d95699f938fc5ee6c333021681 |
|
MD5 | a46d2c9a0cfc6bab83db4390ddce7305 |
|
BLAKE2b-256 | d5bb975cc5af3b729044c57d332f5335d5d6e253606ad12d0bbcd137ad6c513e |
Hashes for pyspng_seunglab-1.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 404180ba478814ad4feb5f363922d29b236ecb2b71b50db5cf33087f6c6bc178 |
|
MD5 | bb647b26a4b1058b5b029352e53990ce |
|
BLAKE2b-256 | c7c728d58c3323622436910dc45c1169f14d37fd8e88e8e74f85799da4e4397f |
Hashes for pyspng_seunglab-1.1.0-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f4d96e698275a28a1f6e6c5db90c8c37600fc2756fc0983394e23d4bb19a85b |
|
MD5 | 6d370f481df45504909786229543f167 |
|
BLAKE2b-256 | 4286a8d8ce5eb40fb61fd248ab5d54efe873faf4aca3e32d2b3b963e68c96a62 |
Hashes for pyspng_seunglab-1.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 362d402c985fbfca31a2e3bfb9b62784c203904f4b88486ae24e4d170b8f9efa |
|
MD5 | 36255afe29b80d984d431b10f7cc4798 |
|
BLAKE2b-256 | bd03b668ad898b59ab0afc05f5be32af356442af13062043fe7d92db9b50d0af |
Hashes for pyspng_seunglab-1.1.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2af6b116c83727e42499879e1e3f5f8f2f755ea610a0df8928310f971b335f7 |
|
MD5 | 1a67af60d90fcfd41d9f1d56cd7ed3b8 |
|
BLAKE2b-256 | 2d9e32ee1bf4fa6976e4a40c33ead89cb6c3b74cb688602a94a48eaef7d6c44b |
Hashes for pyspng_seunglab-1.1.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76af5371b5b992301b2583be2d4ee5de904aed21c3796d352be71773c60bcca5 |
|
MD5 | 422a670aa669b200084f35a37239f4c5 |
|
BLAKE2b-256 | 365ced1348394b92d3e7894802d213bdc86e3bec68f6fdf73b611335dce8f4af |
Hashes for pyspng_seunglab-1.1.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d3a8ad8ad95f802b946630fa63eff3b3b3897096c92752edc9543f65fe5fb59 |
|
MD5 | 98ab162ef6447b4c57239137bb47a9f7 |
|
BLAKE2b-256 | 8da88e32a0595aa841b67938d2ab976661600e7150e59b1974250e78def28e15 |
Hashes for pyspng_seunglab-1.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3614902dfdefd4782d2411481f9a00573feb4302ee40c90875e42d32cc3746b9 |
|
MD5 | 0aa04b9718012526295414da21cdfcba |
|
BLAKE2b-256 | 6fb3b14d5f92995d84510f46745885487a81ef2f50bfe061876f6d35818c1741 |
Hashes for pyspng_seunglab-1.1.0-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ee2fe8af47694afc170f05f155639d314ecf117692ec94835e38189732b5537 |
|
MD5 | 9c33ce972bcc513c7f2b3ba6ba83eba0 |
|
BLAKE2b-256 | 8beb3561200a4433d8ecf54ad1fbeb938f4911421664c18f9a79fa4491fd8cd7 |
Hashes for pyspng_seunglab-1.1.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03baa6f5e3b1865896716016c50be273180418692b80f0278c1253dfdecd2e98 |
|
MD5 | a7fd76e41868a995ffd0452932727ca4 |
|
BLAKE2b-256 | 0552dd4d9c40f841fe40d24ac6711d5d270e209e902fc48a20db69f85ff36475 |
Hashes for pyspng_seunglab-1.1.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5299e6f2797cc4136432434fbc4b2a2b134db0c001e6bec22f9e84f4f5aa0971 |
|
MD5 | 07d45f6cd195bda110c484d858045666 |
|
BLAKE2b-256 | 5e2ebc336f2ae8ccdb3345b217cfb8e6f7a01d21a41b35d8e29af9ec2a985670 |