Gimp.Parasite¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
data |
[ |
r/w |
the parasite data, the owner os the parasite is responsible for tracking byte order and internal structure |
flags |
r/w |
the parasite flags, like save in XCF etc. |
|
name |
r/w |
the parasite name, USE A UNIQUE PREFIX |
|
size |
r/w |
the parasite size in bytes |
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gimp.Parasite¶
Arbitrary pieces of data which can be attached to various GIMP objects.
- classmethod new(name, flags, data)¶
- Parameters:
name (
str
) – the newGimp.Parasite
name.flags (
int
) – see libgimpbase/gimpparasite.h macros.
- Returns:
a new
Gimp.Parasite
.- Return type:
Creates a new parasite and save data which may be a proper text (in which case you may want to set size as strlen(data) + 1) or not.
- compare(b)¶
- Parameters:
b (
Gimp.Parasite
) – aGimp.Parasite
- Returns:
- Return type:
Compare parasite’s contents.
- copy()¶
- Returns:
a newly allocated
Gimp.Parasite
with same contents.- Return type:
Create a new parasite with all the same values.
- free()¶
Free self's dynamically allocated memory.
- get_data()¶
- Returns:
parasite’s data.
- Return type:
[
int
]
Gets the parasite’s data. It may not necessarily be text, nor is it guaranteed to be
None
-terminated. It is your responsibility to know how to deal with this data. Even when you expect a nul-terminated string, it is advised not to assume the returned data to be, as parasites can be edited by third party scripts. You may end up reading out-of-bounds data. So you should only ignore num_bytes when you all you care about is checking if the parasite has contents.
- has_flag(flag)¶