python binding for libvips using cffi

Overview

README

Build Status

PyPI package:

https://pypi.python.org/pypi/pyvips

conda package:

https://anaconda.org/conda-forge/pyvips

We have formatted docs online here:

https://libvips.github.io/pyvips/

This module wraps the libvips image processing library:

https://libvips.github.io/libvips/

The libvips docs are also very useful:

https://libvips.github.io/libvips/API/current/

If you have the development headers for libvips installed and have a working C compiler, this module will use cffi API mode to try to build a libvips binary extension for your Python.

If it is unable to build a binary extension, it will use cffi ABI mode instead and only needs the libvips shared library. This takes longer to start up and is typically ~20% slower in execution. You can find out how pyvips installed with pip show pyvips.

This binding passes the vips test suite cleanly and with no leaks under python2.7 - python3.6, pypy and pypy3 on Windows, macOS and Linux.

How it works

Programs that use pyvips don't manipulate images directly, instead they create pipelines of image processing operations building on a source image. When the end of the pipe is connected to a destination, the whole pipeline executes at once, streaming the image in parallel from source to destination a section at a time.

Because pyvips is parallel, it's quick, and because it doesn't need to keep entire images in memory, it's light. For example, the libvips speed and memory use benchmark:

https://github.com/libvips/libvips/wiki/Speed-and-memory-use

Loads a large tiff image, shrinks by 10%, sharpens, and saves again. On this test pyvips is typically 3x faster than ImageMagick and needs 5x less memory.

There's a handy chapter in the docs explaining how libvips opens files, which gives some more background.

http://libvips.github.io/libvips/API/current/How-it-opens-files.md.html

conda Install

The conda package includes a matching libvips binary, so just enter:

$ conda install --channel conda-forge pyvips

Non-conda install

First, you need the libvips shared library on your library search path, version 8.2 or later, though at least version 8.9 is required for all features to work. On Linux and macOS, you can just install via your package manager; on Windows you can download a pre-compiled binary from the libvips website.

https://libvips.github.io/libvips/install.html

Next, install this package, perhaps:

$ pip install --user pyvips

On Windows, you'll need a 64-bit Python. The official one works well. You will also need to add vips-dev-x.y\bin to your PATH so that pyvips can find all the DLLs it needs. You can either do this in the Advanced System Settings control panel, or you can just change PATH in your Python program.

If you set the PATH environment variable in the control panel, you can use the vips command-line tools, which I find useful. However, this will add a lot of extra DLLs to your search path and they might conflict with other programs, so it's usually safer just to set PATH in your program.

To set PATH from within Python, you need something like this at the start:

import os
vipshome = 'c:\\vips-dev-8.7\\bin'
os.environ['PATH'] = vipshome + ';' + os.environ['PATH']

Now when you import pyvips, it should be able to find the DLLs.

Example

This sample program loads a JPG image, doubles the value of every green pixel, sharpens, and then writes the image back to the filesystem again:

import pyvips

image = pyvips.Image.new_from_file('some-image.jpg', access='sequential')
image *= [1, 2, 1]
mask = pyvips.Image.new_from_array([[-1, -1, -1],
                                    [-1, 16, -1],
                                    [-1, -1, -1]
                                   ], scale=8)
image = image.conv(mask, precision='integer')
image.write_to_file('x.jpg')

Notes

Local user install:

$ pip3 install -e .
$ pypy -m pip --user -e .

Run all tests:

$ tox

Run test suite:

$ tox test

Run a specific test:

$ pytest-3 tests/test_saveload.py

Run perf tests:

$ cd tests/perf
$ ./run.sh

Stylecheck:

$ tox qa

Generate HTML docs in doc/build/html:

$ cd doc; sphinx-build -bhtml . build/html

Regenerate autodocs:

$ cd doc; \
  python3 -c "import pyvips; pyvips.Operation.generate_sphinx_all()" > x

And copy-paste x into the obvious place in doc/vimage.rst.

Update version number:

$ vi pyvips/version.py
$ vi doc/conf.py

Update pypi package:

$ python3 setup.py sdist
$ twine upload dist/*
$ git tag -a v2.1.12 -m "as uploaded to pypi"
$ git push origin v2.1.12
Comments
  • Memory leak when saving pyramid files

    Memory leak when saving pyramid files

    When I open a TIFF image using access='sequential' and then save it using compression='jpeg' memory is not released.

    Minimal example to reproduce the issue (run passing a large image file path as first parameter:

    
    #!/usr/bin/env python3
    
    import sys
    
    import pyvips
    
    fpath = sys.argv[1]
    
    i = 1
    while True:
        print('Iteration {}'.format(i))
        with open(fpath, 'rb') as fh:
            img = pyvips.Image.new_from_buffer(fh.read(), '', access='sequential')
            img.tiffsave('/tmp/flush.tif', compression='jpeg', Q=90)
        i += 1
    

    You can observe memory constantly increasing until eventually the program crashes.

    Note that if I don't use sequential access, or JPEG compression, the memory is flushed as normal.

    opened by scossu 52
  • Pyvips | Best way to create large histology image of size 5000000X5000000 pixels.

    Pyvips | Best way to create large histology image of size 5000000X5000000 pixels.

    Hello, @jcupitt!

    I am new to pyvips, I want to create a large image. Following steps, I have to take:

    1. Finding coordinates as the stage is not precise. Using NCC based matching.
    2. Making a large background image to overlay each image using their global coordinate.
    3. Saving it in dzi format (is it possible to view real-time stitching). I have tried all the three steps. I am stuck in last two part.

    Issues:

    1. When I am overlaying next image the previous image vanishes. I have tried all this method from this post . Can you also explain what is the various mode of an argument? Attached example code
    import sys
    import random
    from PIL import Image
    import numpy as np
    import pyvips
    
    output_size = 2000
    bg = pyvips.Image.black(output_size, output_size, bands=3)
    tile1 = pyvips.Image.new_from_file('1805_corrected.jpg', access="sequential")
    tile2 = pyvips.Image.new_from_file('1806_corrected.jpg', access="sequential")
    vips_image1 = tile1.embed(0, 0, output_size, output_size)   
    vips_image2 = tile2.embed(1000,1000, output_size, output_size) 
    vips_image=vips_image1.composite(vips_image2,["over"])
    vips_image.write_to_file('vi_1.tiff')
    
    
    1. My data size would be very large, what would be the best way to mosaic this images?
    2. In the past, I have used Image.join function to create mosaic but the problem was when I exceed certain limit .dzsave takes lots of time and sometimes segmentation fault occurs.
    3. Is there any method in pyvips to match images two find coordinates for matching?
    opened by shivamchaubey 41
  • Error: VipsForeignLoadJpegFile does not support optional argument level

    Error: VipsForeignLoadJpegFile does not support optional argument level

    Hello, l m trying to get my image like a pyramidal tiff on level 0. So my images are on the format 'jpeg' and l want to them on "tif" format with the level zero. So l did :

    import pyvips as pv
    pv = pv.Image.new_from_file("/Users/eudari01/GNNs_Vs_CNNs/test/1.jpg", level=0)
    pv.tiffsave('1.tif', compression= 'jpeg', pyramide= True, title = True)
    

    and l got the error, VipsForeignLoadJpegFile does not support optional argument level.

    my question is the next one. How can l have a level (0) in my images ?

    Many thanks

    opened by jeremyEudaric 34
  • pyvips installs in abi mode despite vips being present

    pyvips installs in abi mode despite vips being present

    Is there an argument I can pass to pyvips to find a local install of libvips ?

    (ipy3) [sajid@xrmlite ~]$ which vips
    ~/packages/spack/opt/spack/linux-centos7-x86_64/gcc-8.3.0/libvips-8.7.4-rilxe37cjuisabs3kzapoljmdcr7jivc/bin/vips
    (ipy3) [sajid@xrmlite ~]$ pip install --user pyvips
    Collecting pyvips
    Requirement already satisfied: cffi>=1.0.0 in ./miniconda3/envs/ipy3/lib/python3.6/site-packages (from pyvips)
    Requirement already satisfied: pycparser in ./miniconda3/envs/ipy3/lib/python3.6/site-packages (from cffi>=1.0.0->pyvips)
    Installing collected packages: pyvips
    Successfully installed pyvips-2.1.5
    You are using pip version 9.0.1, however version 19.0.3 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    (ipy3) [sajid@xrmlite ~]$ pip show pyvips
    Name: pyvips
    Version: 2.1.5
    Summary: binding for the libvips image processing library, ABI mode
    Home-page: https://github.com/libvips/pyvips
    Author: John Cupitt
    Author-email: [email protected]
    License: MIT
    Location: /home/sajid/.local/lib/python3.6/site-packages
    Requires: cffi
    You are using pip version 9.0.1, however version 19.0.3 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    (ipy3) [sajid@xrmlite ~]$
    
    opened by s-sajid-ali 29
  • Fast way to write pyvips image to FFmpeg stdin (and others; suggestions; big read)

    Fast way to write pyvips image to FFmpeg stdin (and others; suggestions; big read)

    Hey @jcupitt, looks like you're very active helping people here so I thought it wouldn't hurt asking something. This will be a bit long as I'll give you the full context and wanted some suggestions if possible.

    I'm working on a project in making a music visualizer and unsurprisingly I'm dealing with lots and lots of image processing, gaussian blur, vignetting, resize, alpha composite, etc.

    While numpy + PIL works they aren't that much fast comparing to a proper image library or some GPU accelerated canvas (this last one woudn't quite work because I have to move back and forth a lot of images, and textures are somewhat expensive so I'd have to process them on the GPU itself, I'm not that deep into it yet)

    For a 8.5 second audio using non multiprocessed code it takes about 3 minutes to make a 720p60 video out of it, I thought: hmm I don't have only one thread on my CPU so multiprocessing would work better, right? no! the IPC and mutexes shenanigans I wasn't aware about didn't scale up much, it cut in half the processing time down to 1m30sec though.

    I tried using something like NodeJS and thought using C++ with Python to alpha composite and process the images very fast, the first one didn't quite work and haven't tried the second one yet.

    So I stumbled across pyvips and with little effort I could alpha composite 100 particle images (random coordinates) onto a 4k image at 84 fps!! and it didn't even use much RAM and only half the CPU.

    Though when piping the images to FFmpeg we have to convert them into a format we can write to the stdin and be readable + compatible by FFmpeg and its arguments.

    Here comes my question after this short context: when I use something like

    • image.write_to_buffer('.JPEG', Q=100)

    • image = np.ndarray(buffer=image.write_to_memory(), dtype=format_to_dtype[image.format], shape=[image.height, image.width, image.bands])

    Piping the images takes about 0.0764 seconds in total each cycle of making + converting to bytes + write to stdin but those two example lines takes about 0.0617 seconds to run. (those numbers are average of 510 piped frames). That's nearly all the time spend on the loop.

    I'm not sure of how I can ask this but am I doing something wrong or is there an better way of getting the full fat raw image out of a pyvips Image object and send to FFmpeg stdin?

    Again, this is my main bottleneck so any advice on quickly converting the images to a video is what I need.

    I use somewhat canonical piping arguments (with ffmpeg-python package)

    self.pipe_subprocess = (
        ffmpeg
        .input('pipe:', format='image2pipe', pix_fmt='rgba', r=self.context.fps, s='{}x{}'.format(self.context.width, self.context.height))
        .output(output, pix_fmt='yuv420p', vcodec='libx264', r=self.context.fps, crf=18, loglevel="quiet")
        .global_args('-i', self.context.input_file)
        .overwrite_output()
        .run_async(pipe_stdin=True)
    )
    

    I only change image2pipe with rawvideo when piping the numpy array's raw data.

    I've seen and read a few places before asking this, most notably:

    And I've tried lurking the docs on pyvips.Image class.

    I'm looking forward using this library for images from now on, it works really well and is VERY simple to use.

    I almost cried when I saw the Image.composite method, that is because I had manually implemented something equal to this by hand here (spoiler: it took a while to crop and composite only the needed parts)

    And looks like pyvips can handle big images like they are nothing!!

    Thanks for the project for using libvips easily through Python.

    question 
    opened by Tremeschin 25
  • cannot load library 'libvips-42.dll'

    cannot load library 'libvips-42.dll'

    After trying all the workarounds mentioned in your issues section, I still cannot get rid of this error. Posting the traceback of the error

    (base) C:\Users\IIIT\Downloads\vips-dev-w64-all-8.6.3-1\vips-dev-8.6\bin>python Python 3.6.4 |Anaconda custom (64-bit)| (default, Mar 12 2018, 20:20:50) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

    import pyvips Traceback (most recent call last): File "C:\Users\IIIT\AppData\Roaming\Python\Python36\site-packages\pyvips_init_.py", line 19, in import _libvips ModuleNotFoundError: No module named '_libvips'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "", line 1, in File "C:\Users\IIIT\AppData\Roaming\Python\Python36\site-packages\pyvips_init_.py", line 54, in vips_lib = ffi.dlopen(_vips_libname) File "C:\Users\IIIT\Anaconda3\lib\site-packages\cffi\api.py", line 141, in dlopen lib, function_cache = _make_ffi_library(self, name, flags) File "C:\Users\IIIT\Anaconda3\lib\site-packages\cffi\api.py", line 802, in _make_ffi_library backendlib = _load_backend_lib(backend, libname, flags) File "C:\Users\IIIT\Anaconda3\lib\site-packages\cffi\api.py", line 798, in _load_backend_lib return backend.load_library(path, flags) OSError: cannot load library 'libvips-42.dll': error 0x7f

    Any other information if needed, please ask.

    question 
    opened by Suvi-dha 25
  • PNG file of smaller resolution is bigger than a smaller one? - size optimization mystery.

    PNG file of smaller resolution is bigger than a smaller one? - size optimization mystery.

    I need to transfer fast lots of images over a limited link. Color count is <10 When converting 553x288 svg to .png (compression=6), I had an average filesize of 36kB then I reduced the resolution of the svg to 472x288 (trimmed off a black area)
    now the average file size is 43kB.

    Is png more efficient at some specific resolutions/aspect ratios? , when it can be divided by some specific number?

    opened by AndKe 23
  • crop error on datageneration deep learning

    crop error on datageneration deep learning

    pyvips.error.Error: Caught Error in DataLoader worker process 3. Original Traceback (most recent call last): File "/home/vankhoa/anaconda3/envs/py36con/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/vankhoa/anaconda3/envs/py36con/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/vankhoa/anaconda3/envs/py36con/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/vankhoa/code/Bayer/MILPath/utils/datagen.py", line 57, in getitem img = utils.read_region(self.slides[slideIDX], coord, self.level, self.size) File "/home/vankhoa/code/Bayer/MILPath/utils/utils.py", line 49, in read_region img_vips = slide.copy().crop(coord[0], coord[1], size, size) File "/home/vankhoa/anaconda3/envs/py36con/lib/python3.6/site-packages/pyvips/vimage.py", line 805, in call_function return pyvips.Operation.call(name, self, *args, **kwargs) File "/home/vankhoa/anaconda3/envs/py36con/lib/python3.6/site-packages/pyvips/voperation.py", line 215, in call raise Error('unable to call {0}'.format(operation_name)) pyvips.error.Error: unable to call crop extract_area: bad extract area

    Hello, this is the error I received when load tif pathology slide, then crop it to get the tiles used to train batch for deep learning. I verified that the coord are within the image. The similar approach using openslide.read_region works well. Could you give me your idea about this? Thanks.

    Process finished with exit code 1

    opened by vankhoa21991 23
  • Error while using new_from_buffer

    Error while using new_from_buffer

    Hi,

    I can open files without an issue and all the things work well then. But if I directly pass the bytes what I got from aiohttp, it throws an error: TypeError: initializer for ctype 'int(*)(void *, void *)' must be a pointer to same type, not cdata 'void(*)(void *)'

    Here is my buffer's first few lines:

    b"\x89PNG\r\n\x1a\n\x00\x00"
    

    And some details from Sentry if you need them image

    What can I do?

    question 
    opened by Diniboy1123 23
  • Switch to new-style callbacks

    Switch to new-style callbacks

    See: https://cffi.readthedocs.io/en/latest/using.html#extern-python-new-style-callbacks

    The original callbacks are slower to invoke and have the same issue as libffi’s callbacks; notably, see the warning. The new style described in the present section does not use libffi’s callbacks at all.

    Occurrences of ffi.callback: https://github.com/libvips/pyvips/blob/1dc365a3beb6484d609d3aa725cd871c68af2ef0/pyvips/gvalue.py#L23 (Seems no longer used ?)

    https://github.com/libvips/pyvips/blob/52e218462af9261766f5aebf60b8a39ef0c3e2c2/pyvips/init.py#L134 (Used by the log handler)

    https://github.com/libvips/pyvips/blob/52e218462af9261766f5aebf60b8a39ef0c3e2c2/pyvips/base.py#L87 (Used by the documentation generator)

    https://github.com/libvips/pyvips/blob/1dc365a3beb6484d609d3aa725cd871c68af2ef0/pyvips/voperation.py#L106 (Hot path code, used by almost all pyvips operations. Perhaps we should use vips_object_get_args for libvips 8.7+. See the lua-vips implementation)

    This comment can also be solved using the new style callbacks.

    After this has been resolved, we should look at https://github.com/libvips/pyvips/issues/21 again and benchmark it under cffi's API mode (the Pillow performance test suite still depends on an older version of pyvips which doesn't support the API mode).

    in development 
    opened by kleisauke 21
  • magickload should have a format hint parameter

    magickload should have a format hint parameter

    Hi,

    handling images that would cause a fallback towards ImageMagick doesn't work as expected. Given an exemplary image, located at https://www.welt.de/favicon.ico, the actual vips-cli is capable to handle it. A command like

    vips copy favicon.ico favicon.jpeg

    completes without any error. Also the following python code completes without any error:

    img = pyvips.Image.new_from_file("favicon.ico")
    print "Height: %s; Width: %s" % (img.height, img.width)
    

    But loading the image from the buffer will result in an error:

    with open("favicon.ico", "rb") as f:
        buf = f.read()
    img = pyvips.Image.new_from_buffer(buf, '*')
    

    ->

    Traceback (most recent call last):
      File "test.py", line 10, in <module>
        img = pyvips.Image.new_from_buffer(buf, "")
      File "/home/philip/.local/lib/python2.7/site-packages/pyvips/vimage.py", line 247, in new_from_buffer
        raise Error('unable to load from buffer')
    pyvips.error.Error: unable to load from buffer
      VipsForeignLoad: buffer is not in a known format
    
    enhancement 
    opened by Flips01 21
  • Gif only saves as first frame

    Gif only saves as first frame

    Hi! I want to add some text to a gif, but when I save it runs with no errors but only saves the first frame. After removing everything else and just loading and saving it still doesnt work:

    gif = pyvips.Image.magickload('https://media.tenor.com/BSi7CbeeVSEAAAAd/gato-cat.gif')
    gif.magicksave('./test.gif')
    

    Im using pyvips 2.2.1 on linux mint 20.3 Not sure why its not saving the full gif? Using print(gif.get('n-pages')) shows the correct number of frames so im not sure whats wrong. I also tried using gifload_source and gifsave but I get an error: AttributeError: 'str' object has no attribute 'pointer' How can I get the gif to save properly?

    Thanks in advance

    opened by will-171 4
  • How to can stitch multiple .tiff file as single file tiff file.

    How to can stitch multiple .tiff file as single file tiff file.

    I am working on whole slide imaging of blood smear slide. i am having a thousands of picture which i want to stitch together to make a single tiff file. Please suggest me how to achieve it as i new on image processing.

    opened by kuldeep203 3
  • Simply opening a photo and saving it doubles the file size with Q=100

    Simply opening a photo and saving it doubles the file size with Q=100

    As the title says, simply doing this:

    file = open(sys.argv[1], mode="rb")
    image = pyvips.Image.new_from_buffer(file.read(), options="", access="sequential", autorotate=True)
    image.write_to_file("applied_layer.jpg", Q=100)
    

    Results in a photo being double the size. 1.8MB results in 3.6MB. I've tested this with 3 photos taken with different DSLR cameras and they all reproduce.

    My code actually adds a watermark to the photo, so I don't want to have so much extra storage, but I don't want to lose any photo quality.

    Could anyone help me with this? I uploaded a sample photo but I am not sure if github will save it properly to reproduce the issue Thanks

    6C7B9450

    opened by mcosti 3
  • Getting pyvips to work on Mac with python 3.7.7

    Getting pyvips to work on Mac with python 3.7.7

    I have installed pyvips using pip on python 3.7.7 virtual environment. When I try to load an svs image at {{PATH_TO_FILE}} I get:

    Python 3.7.7 (default, Mar 23 2020, 17:31:31)
    [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pyvips
    >>> slide = pyvips.Image.new_from_file({{PATH_TO_FILE}})
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/disco/Sandbox/2020_11_django/HemeLabel/HemeLabel_env/lib/python3.7/site-packages/pyvips/vimage.py", line 349, in new_from_file
        raise Error('unable to load from file {0}'.format(vips_filename))
    pyvips.error.Error: unable to load from file b'"{{PATH_TO_FILE}}'
      VipsForeignLoad: file "{{PATH_TO_FILE}}" does not exist
    

    Not sure what to do next. Cannot install a different version of python as this is part of a large existing application.

    opened by gregster7 7
  • Online source for images (download and convert)

    Online source for images (download and convert)

    I'm getting errors when trying to use a URL for the source of an image load - "VipsForeignLoad... jpg does not exist" Am I right in assuming that online sources of images aren't able to be processed by pyvips?

    I was hoping to avoid actually saving the original remote image (and then circling back to delete it).

    Alternatively would it be possible to pass a response from Requests straight to pyvips and avoid a disk write?

    opened by dreadedhamish 2
  • question: how do i split a tilesheet into multiple grid and merge them together?

    question: how do i split a tilesheet into multiple grid and merge them together?

    I need to work with a tilesheet, composed of 10x10 tiles. for example, a 160x2560 image would contain 16x256=4096 tiles. after that, I need to merge those 4096 10x10 images back into 160x2560 image. I tried this:

    #!/usr/bin/python3
    
    from pathlib import Path
    from pyvips import Image, Region
    
    base = Path("ASCIITileset")
    tiles = base / "ASCIITiles.png"
    fallback = base / "fallback.png"
    config = base / "tile_config.json"
    
    image = Image.new_from_file(fallback, memory=True)  # type: ignore
    
    
    def fetch(region: Region, x: int, y: int, size: int):
        return region.fetch(size * x, size * y, size, size)
    
    
    patch_size = 10
    width: int = image.width
    height: int = image.height
    rows, cols = height // patch_size, width // patch_size
    
    
    region = Region.new(image)
    print(f"{width=}, {height=}, {patch_size=}, {rows=}, {cols=}")
    # res = image.grid(patch_size, rows, cols)
    print(rows, cols)
    Path("patches").mkdir(exist_ok=True)
    
    for y in range(rows):
        for x in range(cols):
            print(f"({x}, {y})")
            patch = fetch(region, x, y, patch_size)
            img = Image.new_from_buffer(patch, "")
            img.write_to_file(f"patches/{y}-{x}.png")
    

    but encountered with:

    width=160, height=2560, patch_size=10, rows=256, cols=16
    256 16
    (0, 0)
    Traceback (most recent call last):
      File "/home/scarf/repo/cata/tileset-tools/learnvips.py", line 43, in <module>
        img = Image.new_from_buffer(patch, "")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/scarf/.asdf/installs/python/3.11.0rc2/lib/python3.11/site-packages/pyvips/vimage.py", line 384, in new_from_buffer
        pointer = vips_lib.vips_foreign_find_load_buffer(data, len(data))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: initializer for ctype 'void *' must be a cdata pointer, not _cffi_backend.buffer
    
    opened by scarf005 5
Owner
libvips
A fast image processing library with low memory needs.
libvips
Wand is a ctypes-based simple ImageMagick binding for Python

Wand Wand is a ctypes-based simple ImageMagick binding for Python, supporting 2.7, 3.3+, and PyPy. All functionalities of MagickWand API are implement

Eric McConville 1.2k Jan 3, 2023
Python binding to Skia Graphics Library

Skia python binding Python binding to Skia Graphics Library. Binding based on pybind11. Currently, the binding is under active development. Install Bi

Kota Yamaguchi 170 Jan 6, 2023
Hello, this project is an example of how to generate a QR Code using python 😁

Hello, this project is an example of how to generate a QR Code using python ??

Davi Antonaji 2 Oct 12, 2021
Optimize/Compress images using python

Image Optimization Using Python steps to run the script run the command to install the required libraries pip install -r requirements.txt create a dir

Shekhar Gupta 1 Oct 15, 2021
Create a QR-code Generator app using only Python.

QR-code_Generator Create a QR-code Generator app using only Python. This apps generated a QR code for a single link. Libraryes used in this app --> py

Soham P Phasalkar 1 Oct 17, 2021
Using P5.js, Processing and Python to create generative art

Experiments in Generative Art Using Python, Processing, and P5.js Quick Links Daily Sketches March 2021. | Gallery | Repo | Done using P5.js Genuary 2

Ram Narasimhan 33 Jul 6, 2022
LSB Image Steganography Using Python

Steganography is the science that involves communicating secret data in an appropriate multimedia carrier, e.g., image, audio, and video files

Mahmut Can Gönül 2 Nov 4, 2021
View images in the terminal using ansi escape codes and python

terminal-photo-viewer view images in the terminal using ansi escape codes and python !! Only tested on Ubuntu 20.04.3 LTS with python version 3.8.10 D

null 1 Nov 30, 2021
Create a 2D mesh for an airfoil in GMSH using python.

GMSHFoil A simple class to create a 2D mesh for an airfoil in GMSH using python. Requirements pip install airfoils

Charilaos Mylonas 1 May 16, 2022
This piece of code is a User Welcomer with Image Manipulation using Python and Pillow (PIL).

This piece of code is a User Welcomer with Image Manipulation using Python and Pillow (PIL).

Bero 4 Jan 11, 2022
Create QR Code for link using Python

Quick Response QR is short and named for a quick read from a cell phone. Used to view information from transitory media and put it on your cell phone.

Coding Taggers 1 Jan 9, 2022
Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Kizdude 2 Jan 22, 2022
Simple Python package to convert an image into a quantized image using a customizable palette

Simple Python package to convert an image into a quantized image using a customizable palette. Resulting image can be displayed by ePaper displays such as Waveshare displays.

Luis Obis 3 Apr 13, 2022
An async Python library to automate solving ReCAPTCHA v2 by audio using Playwright.

Playwright nonoCAPTCHA An async Python library to automate solving ReCAPTCHA v2 by audio using Playwright. Disclaimer This project is for educational

Michael Mooney 69 Dec 28, 2022
Paper backup of files using QR codes

Generate paper backups for Linux. Currently command-linux Linux only. Takes any file, and outputs a "paper backup": a printable black-and-white pdf fu

Zachary Vance 27 Dec 28, 2022
pix2tex: Using a ViT to convert images of equations into LaTeX code.

The goal of this project is to create a learning based system that takes an image of a math formula and returns corresponding LaTeX code.

Lukas Blecher 2.6k Dec 30, 2022
Multi-view 3D reconstruction using neural rendering. Unofficial implementation of UNISURF, VolSDF, NeuS and more.

Multi-view 3D reconstruction using neural rendering. Unofficial implementation of UNISURF, VolSDF, NeuS and more.

Jianfei Guo 683 Jan 4, 2023
Unique image & metadata generation using weighted layer collections.

nft-generator-py nft-generator-py is a python based NFT generator which programatically generates unique images using weighted layer files. The progra

Jonathan Becker 243 Dec 31, 2022
An API that renders HTML/CSS content to PNG using Chromium

html_png An API that renders HTML/CSS content to PNG using Chromium Disclaimer I am not responsible if you happen to make your own instance of this AP

null 10 Aug 8, 2022