Vips.ForeignSave¶
- Subclasses:
None
Methods¶
- Inherited:
Vips.Foreign (11), Vips.Operation (4), Vips.Object (27), GObject.Object (37)
- Structs:
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w |
Background value |
||
r/w |
Image to save |
||
r/w |
Which metadata to retain |
||
r/w |
Set page height for multipage save |
||
r/w |
Filename of ICC profile to embed |
||
r/w |
Strip all metadata from image |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
background |
r |
||
r |
|||
keep |
r |
||
page_height |
r |
||
parent_object |
r |
||
profile |
r |
||
ready |
r |
||
strip |
r |
Class Details¶
- class Vips.ForeignSave(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
An abstract base class to save images in a variety of formats.
- Writing a new saver
Call your saver in the class’ [vfunc`Object`.build] method after chaining up. The prepared image should be ready for you to save in
ready.As a complete example, here’s the code for the CSV saver, minus the calls to the actual save routines.
```c typedef struct _VipsForeignSaveCsv {
Vips.ForeignSaveparent_object;str*filename; conststr*separator; } VipsForeignSaveCsv;typedef
Vips.ForeignSaveClassVipsForeignSaveCsvClass;G_DEFINE_TYPE(VipsForeignSaveCsv, vips_foreign_save_csv, VIPS_TYPE_FOREIGN_SAVE);
static int vips_foreign_save_csv_build(
Vips.Object*object) {Vips.ForeignSave*save = (Vips.ForeignSave*) object; VipsForeignSaveCsv *csv = (VipsForeignSaveCsv *) object;if (VIPS_OBJECT_CLASS(vips_foreign_save_csv_parent_class) ->build(object)) return -1;
if (vips__csv_write(save->ready, csv->filename, csv->separator)) return -1;
return 0; }
static void vips_foreign_save_csv_class_init(VipsForeignSaveCsvClass *class) {
GObject.ObjectClass*gobject_class = G_OBJECT_CLASS(class);Vips.ObjectClass*object_class = (Vips.ObjectClass*) class;Vips.ForeignClass*foreign_class = (Vips.ForeignClass*) class;Vips.ForeignSaveClass*save_class = (Vips.ForeignSaveClass*) class;gobject_class->set_property =
Vips.Object.set_property; gobject_class->get_property =Vips.Object.get_property;object_class->nickname = “csvsave”; object_class->description = _(“save image to csv file”); object_class->build = vips_foreign_save_csv_build;
foreign_class->suffs = vips__foreign_csv_suffs;
save_class->saveable =
Vips.ForeignSaveable.MONO; // no need to define ->format_table, we don’t want the input // cast for usVIPS_ARG_STRING(class, “filename”, 1, _(“Filename”), _(“Filename to save to”),
Vips.ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET(VipsForeignSaveCsv, filename),None);VIPS_ARG_STRING(class, “separator”, 13, _(“Separator”), _(“Separator characters”),
Vips.ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET(VipsForeignSaveCsv, separator), “\t”); }static void vips_foreign_save_csv_init(VipsForeignSaveCsv *csv) { csv->separator =
GLib.strdup(”\t”); } ```
Property Details¶
- Vips.ForeignSave.props.background¶
- Name:
background- Type:
- Default Value:
- Flags:
Background value
- Vips.ForeignSave.props.in_¶
- Name:
in- Type:
- Default Value:
- Flags:
Image to save
- Vips.ForeignSave.props.keep¶
- Name:
keep- Type:
- Default Value:
Vips.ForeignKeep.EXIF|Vips.ForeignKeep.XMP|Vips.ForeignKeep.IPTC|Vips.ForeignKeep.ICC|Vips.ForeignKeep.OTHER|Vips.ForeignKeep.GAINMAP|Vips.ForeignKeep.ALL- Flags:
Which metadata to retain
- Vips.ForeignSave.props.page_height¶
-
Set page height for multipage save
- Vips.ForeignSave.props.profile¶
-
Filename of ICC profile to embed