X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b1f8fd3b411a0e36407ea6d2218a61e5a262f309..eae20a30ea20e0292b050d41ad190c0c08c75ec1:/src/common/imagjpeg.cpp diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 86dfa2da77..d045596065 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -310,6 +310,17 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos } } + // set up resolution if available: it's part of optional JFIF APP0 chunk + if ( cinfo.saw_JFIF_marker ) + { + image->SetOption(wxIMAGE_OPTION_RESOLUTIONX, cinfo.X_density); + image->SetOption(wxIMAGE_OPTION_RESOLUTIONY, cinfo.Y_density); + + // we use the same values for this option as libjpeg so we don't need + // any conversion here + image->SetOption(wxIMAGE_OPTION_RESOLUTIONUNIT, cinfo.density_unit); + } + jpeg_finish_decompress( &cinfo ); jpeg_destroy_decompress( &cinfo ); return true;