diff options
Diffstat (limited to 'src/jpeg-utils.cpp')
| -rw-r--r-- | src/jpeg-utils.cpp | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/src/jpeg-utils.cpp b/src/jpeg-utils.cpp index 5c0269a..a552e69 100644 --- a/src/jpeg-utils.cpp +++ b/src/jpeg-utils.cpp @@ -481,33 +481,29 @@ resize_image (const gchar *src, const gchar *dst, { /* Process thumbnail if required */ if (thumbnail) { - switch (exif->squared_thumbnail_type) { - case THUMBNAIL_SQUARE_TYPE_SIMPLE: - w = MagickGetImageWidth (magick_wand); - h = MagickGetImageHeight (magick_wand); - amount = MAX (w, h) * SQUARED_SIMPLE_SHAVE_AMOUNT / 100; - amount = MIN (w - 2*amount, h - 2*amount); - switch (exif->thumbnail_crop_hint) { - case CROP_HINT_UNDEFINED: - case CROP_HINT_CENTER: - MagickCropImage (magick_wand, amount, amount, (w - amount) / 2, (h - amount) / 2); - break; - case CROP_HINT_LEFT: - MagickCropImage (magick_wand, amount, amount, 0, (h - amount) / 2); - break; - case CROP_HINT_RIGHT: - MagickCropImage (magick_wand, amount, amount, w - amount, (h - amount) / 2); - break; - case CROP_HINT_TOP: - MagickCropImage (magick_wand, amount, amount, (w - amount) / 2, 0); - break; - case CROP_HINT_BOTTOM: - MagickCropImage (magick_wand, amount, amount, (w - amount) / 2, h - amount); - break; - } - break; - default: - break; + if (exif->squared_thumbnail) { + w = MagickGetImageWidth (magick_wand); + h = MagickGetImageHeight (magick_wand); + amount = MAX (w, h) * SQUARED_SIMPLE_SHAVE_AMOUNT / 100; + amount = MIN (w - 2*amount, h - 2*amount); + switch (exif->thumbnail_crop_hint) { + case CROP_HINT_UNDEFINED: + case CROP_HINT_CENTER: + MagickCropImage (magick_wand, amount, amount, (w - amount) / 2, (h - amount) / 2); + break; + case CROP_HINT_LEFT: + MagickCropImage (magick_wand, amount, amount, 0, (h - amount) / 2); + break; + case CROP_HINT_RIGHT: + MagickCropImage (magick_wand, amount, amount, w - amount, (h - amount) / 2); + break; + case CROP_HINT_TOP: + MagickCropImage (magick_wand, amount, amount, (w - amount) / 2, 0); + break; + case CROP_HINT_BOTTOM: + MagickCropImage (magick_wand, amount, amount, (w - amount) / 2, h - amount); + break; + } } MagickThumbnailImage (magick_wand, size_x, size_y); /* FIXME: this strips image ICC profile, should do proper conversion first */ |
