Vips.Foreign

g GObject.Object GObject.Object Vips.Object Vips.Object GObject.Object->Vips.Object Vips.Foreign Vips.Foreign Vips.Operation Vips.Operation Vips.Object->Vips.Operation Vips.Operation->Vips.Foreign

Subclasses:

Vips.ForeignLoad, Vips.ForeignSave

Methods

Inherited:

Vips.Operation (4), Vips.Object (27), GObject.Object (37)

Structs:

Vips.ObjectClass (1), GObject.ObjectClass (5)

class

find_load (filename)

class

find_load_buffer (data)

class

find_load_source (source)

class

find_save (filename)

class

find_save_buffer (suffix)

class

find_save_target (suffix)

class

get_suffixes ()

class

is_a (loader, filename)

class

is_a_buffer (loader, data)

class

is_a_source (loader, source)

class

map (base, fn, a, b)

Virtual Methods

Inherited:

Vips.Operation (2), Vips.Object (9), GObject.Object (7)

Properties

Inherited:

Vips.Object (2)

Signals

Inherited:

Vips.Operation (1), Vips.Object (4), GObject.Object (1)

Fields

Inherited:

Vips.Operation (1), Vips.Object (4), GObject.Object (1)

Name

Type

Access

Description

parent_object

Vips.Operation

r

Class Details

class Vips.Foreign(**kwargs)
Bases:

Vips.Operation

Abstract:

Yes

Structure:

Vips.ForeignClass

classmethod find_load(filename)
Parameters:

filename (str) – file to find a loader for

Returns:

the name of an operation on success, None on error

Return type:

str

Searches for an operation you could use to load filename. Any trailing options on filename are stripped and ignored.

See also: Vips.Foreign.find_load_buffer(), vips_image_new_from_file().

classmethod find_load_buffer(data)
Parameters:

data (bytes) – start of memory buffer

Returns:

the name of an operation on success, None on error.

Return type:

str

Searches for an operation you could use to load a memory buffer. To see the range of buffer loaders supported by your vips, try something like:

vips -l | grep load_buffer

See also: vips_image_new_from_buffer().

classmethod find_load_source(source)
Parameters:

source (Vips.Source) – source to load from

Returns:

the name of an operation on success, None on error.

Return type:

str

Searches for an operation you could use to load a source. To see the range of source loaders supported by your vips, try something like:

vips -l | grep load_source

See also: vips_image_new_from_source().

classmethod find_save(filename)
Parameters:

filename (str) – name to find a saver for

Returns:

the name of an operation on success, None on error

Return type:

str or None

Searches for an operation you could use to write to filename. Any trailing options on filename are stripped and ignored.

See also: Vips.Foreign.find_save_buffer(), vips_image_write_to_file().

classmethod find_save_buffer(suffix)
Parameters:

suffix (str) – name to find a saver for

Returns:

the name of an operation on success, None on error

Return type:

str or None

Searches for an operation you could use to write to a buffer in suffix format.

See also: vips_image_write_to_buffer().

classmethod find_save_target(suffix)
Parameters:

suffix (str) – format to find a saver for

Returns:

the name of an operation on success, None on error

Return type:

str or None

Searches for an operation you could use to write to a target in suffix format.

See also: vips_image_write_to_buffer().

classmethod get_suffixes()
Returns:

all supported file extensions, as a None-terminated array.

Return type:

[str]

Get a None-terminated array listing all the supported suffixes.

This is not the same as all the supported file types, since libvips detects image format for load by testing the first few bytes.

Use Vips.Foreign.find_load() to detect type for a specific file.

Free the return result with GLib.strfreev().

classmethod is_a(loader, filename)
Parameters:
  • loader (str) – name of loader to use for test

  • filename (str) – file to test

Returns:

True if filename can be loaded by loader.

Return type:

bool

Return True if filename can be loaded by loader. loader is something like “tiffload” or “VipsForeignLoadTiff”.

classmethod is_a_buffer(loader, data)
Parameters:
  • loader (str) – name of loader to use for test

  • data (bytes) – pointer to the buffer to test

Returns:

True if data can be loaded by loader.

Return type:

bool

Return True if data can be loaded by loader. loader is something like “tiffload_buffer” or “VipsForeignLoadTiffBuffer”.

classmethod is_a_source(loader, source)
Parameters:
  • loader (str) – name of loader to use for test

  • source (Vips.Source) – source to test

Returns:

True if data can be loaded by source.

Return type:

bool

Return True if source can be loaded by loader. loader is something like “tiffload_source” or “VipsForeignLoadTiffSource”.

classmethod map(base, fn, a, b)
Parameters:
Returns:

the result of iteration

Return type:

object or None

Apply a function to every Vips.ForeignClass that VIPS knows about. Foreigns are presented to the function in priority order.

Like all VIPS map functions, if fn returns None, iteration continues. If it returns non-None, iteration terminates and that value is returned. The map function returns None if all calls return None.

See also: vips_slist_map().