summaryrefslogtreecommitdiff
path: root/src/photos
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-08 11:11:23 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-08 11:11:23 +0100
commit1ef9b86df1cca6dde71529f03b66407953d000c9 (patch)
treeb3d41d58cbb1d52e3871e40258539ac760cd265e /src/photos
parentfa4d70ea3101f5a70b33977ba9b7673ddfb36762 (diff)
parent210cc61ee4191465805a770881235c677041f929 (diff)
Update upstream source from tag 'upstream/0.32.15'
Update to upstream version '0.32.15' with Debian dir ab0b4536d524ccbb338db4641523f7abd3f9a2fd
Diffstat (limited to 'src/photos')
-rw-r--r--src/photos/AvifSupport.vala25
-rw-r--r--src/photos/HeifSupport.vala2
-rw-r--r--src/photos/JfifSupport.vala6
-rw-r--r--src/photos/PhotoFileFormat.vala1
-rw-r--r--src/photos/PhotoMetadata.vala4
5 files changed, 31 insertions, 7 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) {
diff --git a/src/photos/HeifSupport.vala b/src/photos/HeifSupport.vala
index 58b9d9d..873e5a1 100644
--- a/src/photos/HeifSupport.vala
+++ b/src/photos/HeifSupport.vala
@@ -128,7 +128,7 @@ public class HeifFileFormatDriver : PhotoFileFormatDriver {
}
public override bool can_write_metadata() {
- return true;
+ return false;
}
public override PhotoFileWriter? create_writer(string filepath) {
diff --git a/src/photos/JfifSupport.vala b/src/photos/JfifSupport.vala
index fc43663..ceca827 100644
--- a/src/photos/JfifSupport.vala
+++ b/src/photos/JfifSupport.vala
@@ -190,7 +190,11 @@ public class JfifWriter : PhotoFileWriter {
}
public override void write(Gdk.Pixbuf pixbuf, Jpeg.Quality quality) throws Error {
- pixbuf.save(get_filepath(), "jpeg", "quality", quality.get_pct_text());
+ if (pixbuf.has_alpha) {
+ apply_alpha_channel(pixbuf).save(get_filepath(), "jpeg", "quality", quality.get_pct_text());
+ } else {
+ pixbuf.save(get_filepath(), "jpeg", "quality", quality.get_pct_text());
+ }
}
}
diff --git a/src/photos/PhotoFileFormat.vala b/src/photos/PhotoFileFormat.vala
index 4c69de3..f7abc33 100644
--- a/src/photos/PhotoFileFormat.vala
+++ b/src/photos/PhotoFileFormat.vala
@@ -251,6 +251,7 @@ public enum PhotoFileFormat {
return PhotoFileFormat.AVIF;
case "heif":
+ case "heic":
return PhotoFileFormat.HEIF;
case "jxl":
diff --git a/src/photos/PhotoMetadata.vala b/src/photos/PhotoMetadata.vala
index 0624b41..3bf7b37 100644
--- a/src/photos/PhotoMetadata.vala
+++ b/src/photos/PhotoMetadata.vala
@@ -1044,6 +1044,10 @@ public class PhotoMetadata : MediaMetadata {
public override string? get_comment() {
var comment = get_first_string_interpreted (COMMENT_TAGS);
+ if (comment == null) {
+ return comment;
+ }
+
try {
var re = new Regex("^charset=\\w+\\s*");
return re.replace(comment, -1, 0, "", RegexMatchFlags.DEFAULT);