From d982fa6f55588ada8e5dd1bcb680ac817fcc5de4 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 4 Oct 2016 21:54:28 +0200 Subject: items: Add option to shave image borders A workaround for badly exported images that contain some garbage at the borders. The amount specifies how many pixels should be shaved from all borders (i.e. amount of 2 results in 4x4 pixels loss). Applicable for particular items or whole album ( section) with the following syntax: --- src/items.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/items.c') diff --git a/src/items.c b/src/items.c index 0ddc3b1..7fed640 100644 --- a/src/items.c +++ b/src/items.c @@ -164,6 +164,7 @@ parse_album_xml (TGallerySetup *setup, const gchar *filename, TPathInfo *path_in } prop_xml_attr (index->properties, PROP_BORDER_STYLE, xml, "/gallery/general/border", "style"); + prop_xml_attr_long (index->properties, PROP_SHAVE_AMOUNT, xml, "/gallery/general/shave", "amount"); index->meta_author = xml_file_get_node_value (xml, "/gallery/general/meta/author/text()"); index->meta_description = xml_file_get_node_value (xml, "/gallery/general/meta/description/text()"); index->meta_keywords = xml_file_get_node_value (xml, "/gallery/general/meta/keywords/text()"); @@ -276,6 +277,10 @@ parse_album_xml (TGallerySetup *setup, const gchar *filename, TPathInfo *path_in } g_free (s); + s = g_strdup_printf ("/gallery/items/*[%d]/shave", i + 1); + prop_xml_attr_long (item->properties, PROP_SHAVE_AMOUNT, xml, s, "amount"); + g_free (s); + s = g_strdup_printf ("/gallery/items/*[%d]/title/text()", i + 1); item->title = xml_file_get_node_value (xml, s); g_free (s); -- cgit v1.2.3