pil — Phatch v0.2 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Phatch v0.2 documentation »
- core »

# pil

All PIL related issues.

class `core.pil.` `InfoPhoto`(info, info_to_dump, get_pil, image=None)

  Bases: `dict`

  `assert_transparency`()
    Raise a `KeyError` for `'transparency'` when `image.mode` is not `'P'`.
  `assert_writable`(tag)

    Assert that the tag is writable. This can raise an `NotWritableTagError` because of several reasons:

    - Tag might be read-only (e.g. Exif_Photo_PixelXDimension)
    - Tag might be not Exif or Iptc
    - Image file format might not allow writing of this tag

    Parameter: | tag (string) – tag name
    Returns: | True, if writable
    Return type: | bool

  `clear_log`()
    Clears the log.
  `close`()
    Remove circular reference.
  `get_log`()

    Get the log contents.

    Returns: | the log
    Return type: | string

  `is_dirty`()

    The photo can become dirty in two ways:

    - new metadata has been set
    - the image has changes size

    In case the image size has changed it will update the `Exif.Photo.PixelXDimension` and `Exif.Photo.PixelYimension` accordingly.

    Returns: | True, if dirty
    Return type: | boolean

  `log`(message)

    Log a message

    Parameter: | message (string) – message

  `save`(target, target_format=None, thumbdata=None)

    Parameters: | target (string) – target filename target_format (string) – target format e.g. obtained by PIL thumbdata (string) – new thumbnail (eg with StringIO, see `imtools`)

  `set`(tag, value)
  `update`(d, explicit=True)
    Do this explicitly so __setitem__ gets called.
  `update_size`()
    If the image is exif writable and if the size has changed, it will update `Exif.Photo.PixelXDimension` and `Exif.Photo.PixelYimension`.

class `core.pil.` `Layer`(filename, position=(0, 0), load=True)
  `apply_pil`(function, *arg, **keyw)
  `open`(uri)

exception `core.pil.` `NotWritableTagError`
  Bases: `exceptions.Exception`

class `core.pil.` `Photo`(info, info_to_dump=None)

  Use `get_photo()` to obtain a photo from a filename.

  `append_to_report`(filename, image=None)
  `apply_pil`(function, *arg, **keyw)
  `call`(command, check_exe=True, shell=None, size=None, unlock=False, output_filename=None, mode=None)
  `clear_log`()
  `close`()
    Remove circular references.
  `convert`(mode, *args, **keyw)
    Converts all layers to a different mode.
  `get_filename`(folder, filename, typ)
  `get_flattened_image`()
  `get_layer`(name=None)
  `get_log`()
  `get_thumb`(size=(128, 128))
  `log`(message)
  `resize`(size, method)
    Resizes all layers to a different size
  `rotate_exif`(reverse=False)
  `safe_mode`(format)
    Convert the photo into a safe mode for this specific format
  `save`(filename, format=None, save_metadata=True, **options)
    Saves a flattened image
  `set_layer`(layer, name=None)

`core.pil.` `fix_EXIF`(tag)

`core.pil.` `get_photo`(filename)

`core.pil.` `image_to_dict`(filename, im=None)

`core.pil.` `split_data`(d)

  Provide attribute access to the variables.

  Parameter: | d (dict) – a dumped metadata dictionary

      >>> d = {'date': '2008-11-27 13:54:33', 'tuple': (1, 2)}

`core.pil.` `split_vars_static_dynamic`(vars)

### Navigation

- index
- modules |
- next |
- previous |
- Phatch v0.2 documentation »
- core »