Ease PIL image pixels loading, accessing, viewing and modifying #20

Open
opened 2024-03-22 17:55:30 +01:00 by Benjamin_Loison · 0 comments
help(Image.Image.load)
Help on function load in module PIL.Image:

load(self)
    Allocates storage for the image and loads the pixel data.  In
    normal cases, you don't need to call this method, since the
    Image class automatically loads an opened image when it is
    accessed for the first time.
    
    If the file associated with the image was opened by Pillow, then this
    method will close it. The exception to this is if the image has
    multiple frames, in which case the file will be left open for seek
    operations. See :ref:`file-handling` for more information.
    
    :returns: An image access object.
    :rtype: :ref:`PixelAccess` or :py:class:`PIL.PyAccess`

In normal cases, you don't need to call this method

Note that no other occurrence of PixelAccess appears in help(PIL.Image.Image).

PIL.Image.Image.getpalette is not interesting.

help(Image.Image.getpixel)
Help on function getpixel in module PIL.Image:

getpixel(self, xy)
    Returns the pixel value at a given position.
    
    :param xy: The coordinate, given as (x, y). See
       :ref:`coordinate-system`.
    :returns: The pixel value.  If the image is a multi-layer image,
       this method returns a tuple.
help(Image.Image.getdata)
Help on function getdata in module PIL.Image:

getdata(self, band=None)
    Returns the contents of this image as a sequence object
    containing pixel values.  The sequence object is flattened, so
    that values for line one follow directly after the values of
    line zero, and so on.
    
    Note that the sequence object returned by this method is an
    internal PIL data type, which only supports certain sequence
    operations.  To convert it to an ordinary sequence (e.g. for
    printing), use ``list(im.getdata())``.
    
    :param band: What band to return.  The default is to return
       all bands.  To return a single band, pass in the index
       value (e.g. 0 to get the "R" band from an "RGB" image).
    :returns: A sequence-like object.
IImage.getdata()
IImage.getdata()[0, 0]
<ImagingCore object at 0x7eff9a2bfdd0>
255
help(PIL.Image.Image.putdata)
help(PIL.Image.Image.putpixel)
help(PIL.Image.Image.show)
help(PIL.Image.Image.frombytes)
help(PIL.Image.Image.getim)
help(PIL.Image.Image.paste)
help(PIL.Image.Image.point)
help(PIL.Image.Image.tobitmap)
help(PIL.Image.Image.tobytes)
help(PIL.Image.Image.toqimage)
help(PIL.Image.Image.toqpixmap)

Related to #15.

```py help(Image.Image.load) ``` ``` Help on function load in module PIL.Image: load(self) Allocates storage for the image and loads the pixel data. In normal cases, you don't need to call this method, since the Image class automatically loads an opened image when it is accessed for the first time. If the file associated with the image was opened by Pillow, then this method will close it. The exception to this is if the image has multiple frames, in which case the file will be left open for seek operations. See :ref:`file-handling` for more information. :returns: An image access object. :rtype: :ref:`PixelAccess` or :py:class:`PIL.PyAccess` ``` > In normal cases, you don't need to call this method Note that no other occurrence of `PixelAccess` appears in `help(PIL.Image.Image)`. `PIL.Image.Image.getpalette` is not interesting. ```py help(Image.Image.getpixel) ``` ``` Help on function getpixel in module PIL.Image: getpixel(self, xy) Returns the pixel value at a given position. :param xy: The coordinate, given as (x, y). See :ref:`coordinate-system`. :returns: The pixel value. If the image is a multi-layer image, this method returns a tuple. ``` ```py help(Image.Image.getdata) ``` ``` Help on function getdata in module PIL.Image: getdata(self, band=None) Returns the contents of this image as a sequence object containing pixel values. The sequence object is flattened, so that values for line one follow directly after the values of line zero, and so on. Note that the sequence object returned by this method is an internal PIL data type, which only supports certain sequence operations. To convert it to an ordinary sequence (e.g. for printing), use ``list(im.getdata())``. :param band: What band to return. The default is to return all bands. To return a single band, pass in the index value (e.g. 0 to get the "R" band from an "RGB" image). :returns: A sequence-like object. ``` ```py IImage.getdata() IImage.getdata()[0, 0] ``` ``` <ImagingCore object at 0x7eff9a2bfdd0> 255 ``` ```py help(PIL.Image.Image.putdata) ``` ```py help(PIL.Image.Image.putpixel) ``` ```py help(PIL.Image.Image.show) ``` ```py help(PIL.Image.Image.frombytes) ``` ```py help(PIL.Image.Image.getim) ``` ```py help(PIL.Image.Image.paste) ``` ```py help(PIL.Image.Image.point) ``` ```py help(PIL.Image.Image.tobitmap) help(PIL.Image.Image.tobytes) help(PIL.Image.Image.toqimage) help(PIL.Image.Image.toqpixmap) ``` Related to #15.
Benjamin_Loison changed title from Ease PIL image pixels loading and accessing to Ease PIL image pixels loading, accessing and modifying 2024-03-22 18:29:11 +01:00
Benjamin_Loison changed title from Ease PIL image pixels loading, accessing and modifying to Ease PIL image pixels loading, accessing, viewing and modifying 2024-03-22 18:37:23 +01:00
Benjamin_Loison added the
low priority
quick
labels 2024-03-26 02:14:03 +01:00
Sign in to join this conversation.
No description provided.