summaryrefslogtreecommitdiff
path: root/src/photos/AvifSupport.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/photos/AvifSupport.vala')
-rw-r--r--src/photos/AvifSupport.vala25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/photos/AvifSupport.vala b/src/photos/AvifSupport.vala
index 842f0fc..0df57a6 100644
--- a/src/photos/AvifSupport.vala
+++ b/src/photos/AvifSupport.vala
@@ -79,7 +79,7 @@ public class AvifWriter : PhotoFileWriter {
}
public override void write(Gdk.Pixbuf pixbuf, Jpeg.Quality quality) throws Error {
- pixbuf.save(get_filepath(), "avif", "quality", "90", null);
+ pixbuf.save(get_filepath(), "avif", "quality", quality.get_pct_text(), null);
}
}
@@ -89,7 +89,8 @@ public class AvifMetadataWriter : PhotoFileMetadataWriter {
}
public override void write_metadata(PhotoMetadata metadata) throws Error {
- metadata.write_to_file(get_file());
+ // TODO: Not yet implemented in gexiv2
+ // metadata.write_to_file(get_file());
}
}
@@ -99,6 +100,19 @@ public class AvifFileFormatDriver : PhotoFileFormatDriver {
public static void init() {
instance = new AvifFileFormatDriver();
AvifFileFormatProperties.init();
+
+ var formats = Gdk.Pixbuf.get_formats();
+ var seen = false;
+ can_write = true;
+
+ foreach (var format in formats) {
+ if (format.get_name() == "avif") {
+ seen = true;
+ can_write = can_write && format.is_writable();
+ }
+ }
+
+ can_write = can_write && seen;
}
public static AvifFileFormatDriver get_instance() {
@@ -112,13 +126,14 @@ public class AvifFileFormatDriver : PhotoFileFormatDriver {
public override PhotoFileReader create_reader(string filepath) {
return new AvifReader(filepath);
}
-
+
+ static bool can_write;
public override bool can_write_image() {
- return true;
+ return AvifFileFormatDriver.can_write;
}
public override bool can_write_metadata() {
- return true;
+ return false;
}
public override PhotoFileWriter? create_writer(string filepath) {