diff options
| author | Dima Kogan | 2016-02-10 15:40:03 +1100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-02-11 14:07:48 +1100 |
| commit | 48b19a4494b1fbe2001d773a2a2c9ede5a557e00 (patch) | |
| tree | 55316f785e199c09f71f5f9b6ea7a9c53e6f1783 /src | |
| parent | e0775d7f7f13eed330d711f604da568453c7eb1d (diff) | |
| download | emacs-48b19a4494b1fbe2001d773a2a2c9ede5a557e00.tar.gz emacs-48b19a4494b1fbe2001d773a2a2c9ede5a557e00.zip | |
Support integer image rotation and respect EXIF rotations
* src/image.c (imagemagick_load_image): Allow integer rotations in
addition to floating point rotations (bug#22591).
* src/image.c (imagemagick_load_image): Images that have an
orientation given in EXIF and have no explicit :rotation tag are now
pre-rotated. All information such as width/height is reported for the
rotated image.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/image.c b/src/image.c index ea5d231720b..e1b167de3d2 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -8560,6 +8560,16 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 8560 | return 0; | 8560 | return 0; |
| 8561 | } | 8561 | } |
| 8562 | 8562 | ||
| 8563 | /* If no :rotation is explicitly specified, apply the automatic | ||
| 8564 | rotation from EXIF. */ | ||
| 8565 | if (NILP (image_spec_value (img->spec, QCrotation, NULL))) | ||
| 8566 | if (MagickAutoOrientImage (image_wand) == MagickFalse) | ||
| 8567 | { | ||
| 8568 | image_error ("Error applying automatic orientation in image `%s'", img->spec); | ||
| 8569 | DestroyMagickWand (image_wand); | ||
| 8570 | return 0; | ||
| 8571 | } | ||
| 8572 | |||
| 8563 | if (ino < 0 || ino >= MagickGetNumberImages (image_wand)) | 8573 | if (ino < 0 || ino >= MagickGetNumberImages (image_wand)) |
| 8564 | { | 8574 | { |
| 8565 | image_error ("Invalid image number `%s' in image `%s'", image, img->spec); | 8575 | image_error ("Invalid image number `%s' in image `%s'", image, img->spec); |
| @@ -8660,7 +8670,7 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 8660 | image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP | 8670 | image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP |
| 8661 | (specified_bg). */ | 8671 | (specified_bg). */ |
| 8662 | value = image_spec_value (img->spec, QCrotation, NULL); | 8672 | value = image_spec_value (img->spec, QCrotation, NULL); |
| 8663 | if (FLOATP (value)) | 8673 | if (FLOATP (value) || INTEGERP (value)) |
| 8664 | { | 8674 | { |
| 8665 | rotation = extract_float (value); | 8675 | rotation = extract_float (value); |
| 8666 | status = MagickRotateImage (image_wand, bg_wand, rotation); | 8676 | status = MagickRotateImage (image_wand, bg_wand, rotation); |