diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2016-10-04 21:54:28 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2016-10-04 21:54:28 +0200 |
| commit | d982fa6f55588ada8e5dd1bcb680ac817fcc5de4 (patch) | |
| tree | 0de45bd9219c49ccd77d4cb6cdae0d55a78a582b /src/items.c | |
| parent | ddd9556689af055355a07cf2766fe95eaed4e38e (diff) | |
| download | cataract-d982fa6f55588ada8e5dd1bcb680ac817fcc5de4.tar.xz | |
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 (<general> section)
with the following syntax:
<shave amount="1" />
Diffstat (limited to 'src/items.c')
| -rw-r--r-- | src/items.c | 5 |
1 files changed, 5 insertions, 0 deletions
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); |
