diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2010-10-09 21:20:13 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2010-10-09 21:20:13 +0200 |
| commit | 69d1615d7dc7500039dbde951fa6cbb920eb99b8 (patch) | |
| tree | 93942d2a2dfe7a3996c3b3d217de0955000daa1d /src/setup.c | |
| parent | a1e7a92e93e4760863105ae9f61ced93510e8cb2 (diff) | |
| download | cataract-69d1615d7dc7500039dbde951fa6cbb920eb99b8.tar.xz | |
Add support for squared thumbnails
Disabled by default, only very simple center crop implemented.
The SQUARED_SIMPLE_SHAVE_AMOUNT constant may be slightly adjusted
according to future experience. It's a really dumb algorithm which
may not be suitable for every picture.
Looking for a fast and smart algorithm to determine image weight center
and radius, i.e. focus on object of interest. The OpenCV's face recognition
features are worth to test and consider, though I fear the speed issues.
Diffstat (limited to 'src/setup.c')
| -rw-r--r-- | src/setup.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/setup.c b/src/setup.c index 6d3c6be..daa1ff0 100644 --- a/src/setup.c +++ b/src/setup.c @@ -123,6 +123,7 @@ parse_setup_xml (const gchar *filename, TGallerySetup *setup) setup->thumbnail_landscape_height = xml_file_get_node_attribute_long (xml, "/gallery_setup/images/thumbnail", "landscape_h", 0); setup->thumbnail_portrait_width = xml_file_get_node_attribute_long (xml, "/gallery_setup/images/thumbnail", "portrait_w", 0); setup->thumbnail_portrait_height = xml_file_get_node_attribute_long (xml, "/gallery_setup/images/thumbnail", "portrait_h", 0); + setup->thumbnail_square_size = xml_file_get_node_attribute_long (xml, "/gallery_setup/images/thumbnail", "square", 0); setup->thumbnail_quality = xml_file_get_node_attribute_long (xml, "/gallery_setup/images/thumbnail", "quality", -1); setup->preview_landscape_width = xml_file_get_node_attribute_long (xml, "/gallery_setup/images/preview", "landscape_w", 0); setup->preview_landscape_height = xml_file_get_node_attribute_long (xml, "/gallery_setup/images/preview", "landscape_h", 0); @@ -157,6 +158,13 @@ parse_setup_xml (const gchar *filename, TGallerySetup *setup) setup->feed_title = xml_file_get_node_value (xml, "/gallery_setup/feed/title/text()"); setup->feed_base_url = xml_file_get_node_value (xml, "/gallery_setup/feed/base_url/text()"); + s = xml_file_get_node_attribute (xml, "/gallery_setup/images/squared_thumbnails", "type"); + if (s && g_ascii_strcasecmp (s, "simple") == 0) + setup->squared_thumbnail_type = THUMBNAIL_SQUARE_TYPE_SIMPLE; + else + setup->squared_thumbnail_type = THUMBNAIL_SQUARE_TYPE_NONE; + g_free (s); + xml_parser_close (xml); return TRUE; } |
