Module guih.lib.ppm

Api used for reading .ppm images that can be exported from gimp in raw mode.

Functions

luappm (path) decodes image with the given path returning all the data
ppmimage.get_pixel (x, y) reads a pixel from the image
ppmimage.get_palette () returns all the diffirent color types from the image and their counts

Tables

ppmimage.data the raw image data from the file
ppmimage.meta all of the metadata in a table
ppmimage.pixels raw map of all the image data
pixel the pixel table properties
palette the palette table properties it is a table of rgb color tables.

Fields

ppmimage.pixels pixel count in the image
ppmimage.width the width of the image
ppmimage.height the height of the image
ppmimage.color_type the color type in this image 255 in most images


Functions

luappm (path)
decodes image with the given path returning all the data

Parameters:

  • path string the path to the image

Returns:

    table the decoded image (ppmimage)
ppmimage.get_pixel (x, y)
reads a pixel from the image

Parameters:

  • x number the x position of the pixel
  • y number the y position of the pixel

Returns:

    table the resulting pixel table. properties: pixel
ppmimage.get_palette ()
returns all the diffirent color types from the image and their counts

Returns:

    table the resulting palette table. properties: palette

Tables

ppmimage.data
the raw image data from the file
ppmimage.meta
all of the metadata in a table
ppmimage.pixels
raw map of all the image data
pixel
the pixel table properties

Fields:

  • r the red color of the pixel
  • g the green color of the pixel
  • b the blue color of the pixel
palette
the palette table properties it is a table of rgb color tables. sorted from most to least common with their counts included

Fields:

  • commonness a single color of this palette

Fields

ppmimage.pixels
pixel count in the image
ppmimage.width
the width of the image
ppmimage.height
the height of the image
ppmimage.color_type
the color type in this image 255 in most images
generated by LDoc 1.4.6 Last updated 2022-06-23 16:51:50