diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2015-01-04 23:01:42 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2015-01-04 23:01:42 +0100 |
| commit | 248a9af6ad668b6f09f79dda548721756fe11d79 (patch) | |
| tree | 6ace053a06d55935e6ff2ba1bf571ab5d6fa7c61 /src/generators.c | |
| parent | cd4658f7154fbfa58c09c101b9753ef85a62620d (diff) | |
| download | cataract-248a9af6ad668b6f09f79dda548721756fe11d79.tar.xz | |
Introduce new "fixed" thumbnail crop mode
This mode retains given aspect ratio and crops the area from inside of the
source image.
Diffstat (limited to 'src/generators.c')
| -rw-r--r-- | src/generators.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/generators.c b/src/generators.c index 2e8cca6..f627839 100644 --- a/src/generators.c +++ b/src/generators.c @@ -300,7 +300,7 @@ metadata_apply_overrides (ExifData *exif_data, if (setup->write_supplied_exif && item->metadata_external_exif) exif_data->external_exif_data = g_path_is_absolute (item->metadata_external_exif) ? g_strdup (item->metadata_external_exif) : g_build_filename (path_info->src_dir, item->metadata_external_exif, NULL); - exif_data->squared_thumbnail = image_size->is_thumbnail && image_size->squared_thumb; + exif_data->thumbnail_crop_style = image_size->is_thumbnail ? image_size->thumb_crop_style : CROP_STYLE_NORMAL; exif_data->thumbnail_crop_hint = get_prop_int (items, item, PROP_THUMB_CROP_HINT, CROP_HINT_UNDEFINED); } @@ -403,8 +403,19 @@ generate_image (TGallerySetup *setup, if (img_w > 0 && img_h > 0) { stats_images_inc (); - if (image_size->is_thumbnail && image_size->squared_thumb) - img_w = img_h = image_size->square_size; + if (image_size->is_thumbnail && image_size->thumb_crop_style != CROP_STYLE_NORMAL) { + switch (image_size->thumb_crop_style) { + case CROP_STYLE_SQUARED: + img_w = img_h = image_size->square_size; + break; + case CROP_STYLE_FIXED: + img_w = image_size->crop_width; + img_h = image_size->crop_height; + break; + default: + g_assert_not_reached (); + } + } else { /* Only the "preview" size is affected by deprecated item and album overrides */ if (is_preview) { @@ -795,7 +806,7 @@ process_img_item (TGallerySetup *setup, if (s2 != NULL) get_image_sizes (s2, &img_thumb_w, &img_thumb_h, setup->autorotate); - if (thumb_image_size->squared_thumb || img_thumb_w == img_thumb_h) + if (img_thumb_w == img_thumb_h) replace_table_add_key (replace_table, "THUMB_ORIENTATION", "squared"); else replace_table_add_key (replace_table, "THUMB_ORIENTATION", (img_thumb_h > img_thumb_w) ? "portrait" : "landscape"); |
