- writing a 2 or 4 channel image to a JPEG will now write that image as
[imager.git] / image.c
diff --git a/image.c b/image.c
index 110f5ef..79230fc 100644 (file)
--- a/image.c
+++ b/image.c
@@ -2433,6 +2433,26 @@ i_img_is_monochrome(i_img *im, int *zero_is_white) {
   return 0;
 }
 
+/*
+=item i_get_file_background(im, &bg)
+
+Retrieve the file write background color tag from the image.
+
+If not present, returns black.
+
+=cut
+*/
+
+void
+i_get_file_background(i_img *im, i_color *bg) {
+  if (!i_tags_get_color(&im->tags, "i_background", 0, bg)) {
+    /* black default */
+    bg->channel[0] = bg->channel[1] = bg->channel[2] = 0;
+  }
+  /* always full alpha */
+  bg->channel[3] = 255;
+}
+
 /*
 =back