diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 11:11:41 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 11:11:41 +0100 |
| commit | 360a72d4363f513a3acaebb084ab39fe3ff22832 (patch) | |
| tree | b3d41d58cbb1d52e3871e40258539ac760cd265e /src/photos/AvifSupport.vala | |
| parent | fa4d70ea3101f5a70b33977ba9b7673ddfb36762 (diff) | |
| parent | 1ef9b86df1cca6dde71529f03b66407953d000c9 (diff) | |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/photos/AvifSupport.vala')
| -rw-r--r-- | src/photos/AvifSupport.vala | 25 |
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) { |
