diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2016-09-11 14:03:13 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2016-09-11 14:03:13 +0200 |
| commit | 6a16a08ea3e75a524cb136f4c6ada1e4eef4bfd4 (patch) | |
| tree | d8e2df15d5ffb61cb3b2a69d73f61597c742256b /src/generators.c | |
| parent | 2a2356513da7a39d68cd5e3d0e3898022de17061 (diff) | |
| download | cataract-6a16a08ea3e75a524cb136f4c6ada1e4eef4bfd4.tar.xz | |
generators: Optionally warn when an image is being resized
This adds commandline argument --debug-warn-resize that is useful
for debugging image resizing, particularly for detecting unintended
supplied image resizes.
Diffstat (limited to 'src/generators.c')
| -rw-r--r-- | src/generators.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/generators.c b/src/generators.c index e08f0f5..7fad313 100644 --- a/src/generators.c +++ b/src/generators.c @@ -431,6 +431,7 @@ generate_image (TGallerySetup *setup, gchar *img_src; gchar *img_dst; unsigned long img_w, img_h; + unsigned long src_img_w, src_img_h; unsigned long tmpw, tmph; int quality; GList *l; @@ -475,8 +476,8 @@ generate_image (TGallerySetup *setup, } /* Resize image */ else { - get_image_sizes (img_src, &img_w, &img_h, setup->autorotate); - if (img_w > 0 && img_h > 0) { + get_image_sizes (img_src, &src_img_w, &src_img_h, setup->autorotate); + if (src_img_w > 0 && src_img_h > 0) { stats_images_inc (); if (image_size->is_thumbnail && image_size->thumb_crop_style != CROP_STYLE_NORMAL) { @@ -493,6 +494,8 @@ generate_image (TGallerySetup *setup, } } else { + img_w = src_img_w; + img_h = src_img_h; /* Only the "preview" size is affected by legacy item and album overrides */ if (is_preview) { tmpw = get_prop_int (items, item, PROP_WIDTH, img_w); @@ -524,10 +527,12 @@ generate_image (TGallerySetup *setup, quality = image_size->quality; /* Perform resize and strip */ + if (setup->warn_resize && ! image_size->is_thumbnail) + printf (" Warning: resizing image %s from %lux%lu to %lux%lu\n", img_src, src_img_w, src_img_h, img_w, img_h); if (! resize_image (img_src, img_dst, img_w, img_h, quality, image_size->is_thumbnail, setup->autorotate, exif_data)) log_error (" Error resizing image %s\n", img_src); } else { - log_error ("generate_image: image %s sizes are %lux%lu\n", img_src, img_w, img_h); + log_error ("generate_image: image %s sizes are %lux%lu\n", img_src, src_img_w, src_img_h); } } } |
