]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 4 Jan 2014 16:47:59 +0000 (16:47 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 4 Jan 2014 16:47:59 +0000 (16:47 +0000)
coders/jp2.c

index 66c32d844f42760a05f97760b45d196ea6996cef..a8bb80d8a439f01f4bbc87289b7d0c6aedd7cf51 100644 (file)
@@ -389,8 +389,16 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
           ThrowReaderException(DelegateError,"UnableToDecodeImageFile");
         }
     }
-  if ((opj_decode(jp2_codec,jp2_stream,jp2_image) == 0) ||
-      (opj_end_decompress(jp2_codec,jp2_stream) == 0))
+  if (image_info->number_scenes != 0)
+    jp2_status=opj_get_decoded_tile(jp2_codec,jp2_stream,jp2_image,
+      image_info->scene);
+  else
+    {
+      jp2_status=opj_decode(jp2_codec,jp2_stream,jp2_image);
+      if (jp2_status != 0)
+        jp2_status=opj_end_decompress(jp2_codec,jp2_stream);
+    }
+  if (jp2_status == 0)
     {
       opj_stream_set_user_data(jp2_stream,NULL);
       opj_stream_destroy_v3(jp2_stream);