Skip to main content

No project description provided

Project description

fpng_py

A C-Python wrapper for fpng, "a very fast C++ .PNG image reader/writer for 24/32bpp images."

Installation

fpng_py is available via pypi, with pre-build wheels for macOS and Windows with SSE enabled. There are no pre-build wheels for Linux, as they would require building without SSE, which would decrease the performance by a fair bit.

via pypi

pip install fpng_py

via git

pip install git+https://github.com/K0lb3/fpng_py.git

via source

pip install .

Functions

def fpng_cpu_supports_sse41() -> bool:
    """
    Returns true if the CPU supports SSE 4.1, and SSE support wasn't disabled by setting FPNG_NO_SSE=1.
    """
    ...


def fpng_crc32(data: bytes, prev_crc32: int = 0) -> int:
    """
    Computes the CRC32 of the given data.
    Fast CRC-32 SSE4.1+pclmul or a scalar fallback (slice by 4)

    Parameters
    ----------
    data : bytes
        The data to compute the CRC32 of.
    prev_crc32 : int, optional
        The previous CRC32 value. Defaults to 0.
    """
    ...


def fpng_adler32(data: bytes, adler: int = 1):
    """
    Computes the Adler32 of the given data.
    Fast Adler32 SSE4.1 Adler-32 with a scalar fallback.

    Parameters
    ----------
    data : bytes
        The data to compute the Adler32 of.
    adler : int, optional
        The previous Adler32 value. Defaults to 1.
    """
    ...


def fpng_encode_image_to_memory(
    image: bytes,
    w: int,
    h: int,
    num_chans: int = 0,
    flags: CompressionFlags = CompressionFlags.NONE,
) -> bytes:
    """
    Encodes the given image into a PNG file in memory.
    Fast PNG encoding. The resulting file can be decoded either using a standard PNG decoder or by the fpng_decode_memory() function below.

    Parameters
    ----------
    image : bytes
        binary data of RGB or RGBA image pixels, R first in memory, B/A last.
        w: int
        width of the image
    h: int
        height of the image
    num_chans: int, optional
        number of channels in the image, 3 for RGB, 4 for RGBA
        if num_chans is 0, it will be inferred from the image data.
        image's row pitch in bytes must is w*num_chans.
    flags: CompressionFlags, optional
        flags for the encoder. Defaults to 0.
    """
    ...


def fpng_encode_image_to_file(
    filename: str,
    image: bytes,
    w: int,
    h: int,
    num_chans: int = 0,
    flags: CompressionFlags = CompressionFlags.NONE,
) -> None:
    """
    Encodes the given image into a PNG file.
    Fast PNG encoding. The resulting file can be decoded either using a standard PNG decoder or by the fpng_decode_memory() function below.

    Parameters
    ----------
    filename : str
        path to the file to write the PNG to.
    image : bytes
        binary data of RGB or RGBA image pixels, R first in memory, B/A last.
    w: int
        width of the image
    h: int
        height of the image
    num_chans: int, optional
        number of channels in the image, 3 for RGB, 4 for RGBA
        if num_chans is 0, it will be inferred from the image data.
        image's row pitch in bytes must is w*num_chans.
    flags: CompressionFlags, optional
        flags for the encoder. Defaults to 0.
    """
    ...


def fpng_get_info(image: bytes) -> Tuple[int, int, int]:
    """
    Returns the width, height and number of channels of the given image.
    Fast PNG decoding of files ONLY created by fpng_encode_image_to_memory() or fpng_encode_image_to_file().
    If fpng_get_info() or fpng_decode_memory() returns FPNG_DECODE_NOT_FPNG, you should decode the PNG by falling back to a general purpose decoder.
    fpng_get_info() parses the PNG header and iterates through all chunks to determine if it's a file written by FPNG, but does not decompress the actual image data so it's relatively fast.

    Parameters
    ----------
    image : bytes
        binary data of RGB or RGBA image pixels, R first in memory, B/A last.

    Returns
    -------
    (width, height, num_chans) : Tuple[int, int, int]
    """
    ...


def fpng_decode_from_memory(
    image: bytes, desired_channels: int
) -> Tuple[bytes, int, int, int]:
    """
    Decodes the given image from memory.
    fpng_decode_memory decompresses 24/32bpp PNG files ONLY encoded by this module.
    If the image is 24bpp and 32bpp is requested, the alpha values will be set to 0xFF.
    If the image is 32bpp and 24bpp is requested, the alpha values will be discarded.

    Parameters
    ----------
    image : bytes
        binary data of RGB or RGBA image pixels, R first in memory, B/A last.
    desired_channels : int
        number of channels to decode the image to.
        3 for RGB, 4 for RGBA

    Returns
    -------
    (image, width, height, num_chans) : Tuple[bytes, int, int, int]
    """
    ...


def fpng_decode_from_file(
    filename: str, desired_channels: int
) -> Tuple[bytes, int, int, int]:
    """
    Decodes the given image from a file.

    fpng_decode_file decompresses 24/32bpp PNG files ONLY encoded by this module.
    If the image is 24bpp and 32bpp is requested, the alpha values will be set to 0xFF.
    If the image is 32bpp and 24bpp is requested, the alpha values will be discarded.

    Parameters
    ----------
    filename : str
        path to the file to decode.
    desired_channels : int
        number of channels to decode the image to.
        3 for RGB, 4 for RGBA

    Returns
    -------
    (image, width, height, num_chans) : Tuple[bytes, int, int, int]
    """
    ...

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

fpng_py-0.0.3.tar.gz (226.3 kB view details)

Uploaded Source

Built Distributions

fpng_py-0.0.3-cp310-cp310-win_amd64.whl (35.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

fpng_py-0.0.3-cp310-cp310-win32.whl (34.3 kB view details)

Uploaded CPython 3.10 Windows x86

fpng_py-0.0.3-cp310-cp310-macosx_10_9_x86_64.whl (36.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

fpng_py-0.0.3-cp39-cp39-win_amd64.whl (35.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

fpng_py-0.0.3-cp39-cp39-win32.whl (34.3 kB view details)

Uploaded CPython 3.9 Windows x86

fpng_py-0.0.3-cp39-cp39-macosx_10_9_x86_64.whl (36.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

fpng_py-0.0.3-cp38-cp38-win_amd64.whl (35.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

fpng_py-0.0.3-cp38-cp38-win32.whl (34.4 kB view details)

Uploaded CPython 3.8 Windows x86

fpng_py-0.0.3-cp38-cp38-macosx_10_9_x86_64.whl (36.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

fpng_py-0.0.3-cp37-cp37m-win_amd64.whl (35.8 kB view details)

Uploaded CPython 3.7m Windows x86-64

fpng_py-0.0.3-cp37-cp37m-win32.whl (34.4 kB view details)

Uploaded CPython 3.7m Windows x86

fpng_py-0.0.3-cp37-cp37m-macosx_10_9_x86_64.whl (36.8 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file fpng_py-0.0.3.tar.gz.

File metadata

  • Download URL: fpng_py-0.0.3.tar.gz
  • Upload date:
  • Size: 226.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d96735dcda0f421af9fd4d633bffa9373731a7e2933c21460a8bf8530dc2921a
MD5 2456a8e42d6ec3d75b4872d091791dcb
BLAKE2b-256 a3828b9f91a46315acdcf19c4c60aacb37104944ff17e0f11454290fafebebc8

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: fpng_py-0.0.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 600720ca889eca9ce1b7d57b0167757080de230edd3961191763db78cb8b0e60
MD5 742435b38f1faebb9ae5e7dfda4175eb
BLAKE2b-256 bfc59ab850f95e03395539e6f7bdcdc167c13faedc74203546f59c700b00b4b1

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp310-cp310-win32.whl.

File metadata

  • Download URL: fpng_py-0.0.3-cp310-cp310-win32.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 2b4ec5d2b2168fea1942fef7fc63c294ce5bc2708224516e64fb04db45d83929
MD5 e0bcdfe0fb01ebdd55fcbf1d9eef4112
BLAKE2b-256 aeda0dc4dbe00325a2bbdf42e6b4c2aa9d6a6caef4396f03542ffd58caff7b5c

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fpng_py-0.0.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 753df3c4487e5b795a956b4bf592d762dd70494de3282110d9359367536c996a
MD5 88f8a0b4410da144b420b8badf5f781a
BLAKE2b-256 f5e6db5fdc55f18a2de23d9348162d14d11c3c7295ebef4e07bc8bef0ae719a7

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: fpng_py-0.0.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 47bc77da0cc4445246ddf50580b4c04f4d08f3106b9edb32682bc5550ca6227f
MD5 13101d146b170a42966959ba1f7eb5f8
BLAKE2b-256 0daeda33110e00e0c7fc78862b7e646325dd257d79fdf7473aec4cd642bc592b

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp39-cp39-win32.whl.

File metadata

  • Download URL: fpng_py-0.0.3-cp39-cp39-win32.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 b4309d7223683456b666c4193975cb3f8a26ce3c39b72251740c39d37001f236
MD5 8f1efb8eca2f9608f6feaa1ea6dbb95a
BLAKE2b-256 3a427b52586d0c98bb7d08af431e070479a27eda08cf5eca858684e9897fd6b3

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fpng_py-0.0.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 abcb3fec6d753f793257d3693a1eedcec012acfa26297b2618b266deffe897bf
MD5 8c5f14f5b41a84f5635bb48fec5ff391
BLAKE2b-256 d6b728ec56157dc69a9833feeff2acb1e7b487bc4677e218d4248a2cb0b398e3

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: fpng_py-0.0.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8b37ba078b94584c93d45a135e32e155920694a75da96855d4b1b9109c6494cc
MD5 c57e63eb709c6def6eec98c7df645ecd
BLAKE2b-256 1928aa721c1f2f1246a6e7b3d126664040c9b350369a4ca6b4831fc0422bbf26

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp38-cp38-win32.whl.

File metadata

  • Download URL: fpng_py-0.0.3-cp38-cp38-win32.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 53a27a50d9d0f46af7d483b9b62e3ab8c4172b40a6c32f4c23466ea67cdf95be
MD5 67393545b236bcd516544bbce6d3225f
BLAKE2b-256 61bcc8e8cf749e6078028d883d07a429e8095b4a9625226b7f8e49eb6c4b7760

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fpng_py-0.0.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 252c52e7e5331850099d748027a17a42b1937f011642ac5653237bda91430678
MD5 5b962e3eab9134859553897f92a57143
BLAKE2b-256 f440d750119af3ca967405233e6f1011935dfc921c86f6a9d5ccada7729471c7

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: fpng_py-0.0.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 95bddea6d19688e82227f8200e8e560547cd3caf4e573d9ecde32c7d2d4ce3a2
MD5 88f732603bd8760ab5923860c95c504f
BLAKE2b-256 a3800f0926e3840f9c2d07a912fa9d8026137f159b9bc4bb5a8ea4447696897c

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp37-cp37m-win32.whl.

File metadata

  • Download URL: fpng_py-0.0.3-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fpng_py-0.0.3-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 6e97cfce157a797231d2cc67da2dcd85dfbd3787a66f948f2e3f2619f569449e
MD5 7cb3d2e9020419aca0b3b036b080a931
BLAKE2b-256 c84d43514d8b3c3a6a3b59ba6a3cf4ac46a244c5d3b0d93a72c2a7ce668c1afd

See more details on using hashes here.

File details

Details for the file fpng_py-0.0.3-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fpng_py-0.0.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 37ca86265afc0947e3187bd2e3dad533a2491d64d8b0b6ccb76ae3932237475d
MD5 9b3346618f5f94087cb8d5844f8e5753
BLAKE2b-256 cd0891034178cf271077a91402ebd3a6370823f220c69d10ecabd59b37aaffed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page