diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2008-07-09 13:09:48 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2008-07-09 13:09:48 +0000 |
commit | d93b6fb5a49befcadd5fc94683f286cc9e8407a2 (patch) | |
tree | 539b794f8fd9adb655f99c41fbfc2a459f8c6edd /Build/source | |
parent | 31f164373aa6a1e163d9a5439ded72e8a3facc34 (diff) |
bugfix for files with mismatched Exif and JFIF data
git-svn-id: svn://tug.org/texlive/trunk@9399 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/jpegimage.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Build/source/texk/xdvipdfmx/src/jpegimage.c b/Build/source/texk/xdvipdfmx/src/jpegimage.c index 6aea61213a3..71cd2ae695c 100644 --- a/Build/source/texk/xdvipdfmx/src/jpegimage.c +++ b/Build/source/texk/xdvipdfmx/src/jpegimage.c @@ -190,6 +190,7 @@ struct JPEG_info #define HAVE_APPn_JFIF (1 << 0) #define HAVE_APPn_ADOBE (1 << 1) #define HAVE_APPn_ICC (1 << 2) +#define HAVE_APPn_Exif (1 << 3) static int JPEG_scan_file (struct JPEG_info *j_info, FILE *fp); static int JPEG_copy_stream (struct JPEG_info *j_info, @@ -335,8 +336,15 @@ jpeg_include_image (pdf_ximage *ximage, FILE *fp) info.bits_per_component = j_info.bits_per_component; info.num_components = j_info.num_components; +#define IS_Exif(j) ((j).flags & HAVE_APPn_Exif) #define IS_JFIF(j) ((j).flags & HAVE_APPn_JFIF) - if (IS_JFIF(j_info)) { + + if (IS_Exif(j_info)) { /* resolution data from EXIF is handled here, + takes precedence over JFIF */ + info.xdensity = 72.0 / j_info.xdpi; + info.ydensity = 72.0 / j_info.ydpi; + } + else if (IS_JFIF(j_info)) { int i; for (i = 0; i < j_info.num_appn; i++) { if (j_info.appn[i].marker == JM_APP0 && j_info.appn[i].app_sig == JS_APPn_JFIF) @@ -358,10 +366,6 @@ jpeg_include_image (pdf_ximage *ximage, FILE *fp) } } } - else { /* resolution data from EXIF is handled here */ - info.xdensity = 72.0 / j_info.xdpi; - info.ydensity = 72.0 / j_info.ydpi; - } pdf_ximage_set_image(ximage, &info, stream); JPEG_info_clear(&j_info); @@ -860,6 +864,7 @@ JPEG_scan_file (struct JPEG_info *j_info, FILE *fp) return -1; length -= 5; if (!memcmp(app_sig, "Exif\000", 5)) { + j_info->flags |= HAVE_APPn_Exif; length -= read_APP1_Exif(j_info, fp, length); } } |