diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-11-23 01:48:55 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-11-23 12:47:36 +0000 |
| commit | 80fafad9c11e0cd8cf9d6ce17deb83be6f680f2d (patch) | |
| tree | ad1b5f69d9863a86ecbf2c46ae0b7916ce60be09 /src/lib/image_decoder.cc | |
| parent | 2f51e117cbaf36b9e0ccb02c338b316fc8e26b9a (diff) | |
First cut at J2K import.
Diffstat (limited to 'src/lib/image_decoder.cc')
| -rw-r--r-- | src/lib/image_decoder.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index 53ef7bae7..f11d37756 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -24,6 +24,7 @@ #include "image_decoder.h" #include "image.h" #include "magick_image_proxy.h" +#include "j2k_image_proxy.h" #include "film.h" #include "exceptions.h" @@ -49,7 +50,15 @@ ImageDecoder::pass () if (!_image_content->still() || !_image) { /* Either we need an image or we are using moving images, so load one */ - _image.reset (new MagickImageProxy (_image_content->path (_image_content->still() ? 0 : _video_position))); + boost::filesystem::path path = _image_content->path (_image_content->still() ? 0 : _video_position); + if (valid_j2k_file (path)) { + /* We can't extract image size from a JPEG2000 codestream without decoding it, + so pass in the image content's size here. + */ + _image.reset (new J2KImageProxy (path, _image_content->video_size ())); + } else { + _image.reset (new MagickImageProxy (path)); + } } video (_image, _video_position); |
