summaryrefslogtreecommitdiff
path: root/src/photos/AvifSupport.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-08 11:11:07 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-08 11:11:07 +0100
commit210cc61ee4191465805a770881235c677041f929 (patch)
tree22dfc8a656a39b95dba2b537f11dcbe36b5c6f0c /src/photos/AvifSupport.vala
parent7868ff68cff97b21fe6d8681f8bc0334849c4d38 (diff)
New upstream version 0.32.15upstream/0.32.15upstream
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) {