]> granicus.if.org Git - imagemagick/blobdiff - coders/jp2.c
Fix for ignoring tiff tags.
[imagemagick] / coders / jp2.c
index ebce595ac3def332c8484d49b6002de348349e9d..effdd9e2a7a9910179e00b514dcb361c7a1fb12d 100644 (file)
@@ -63,6 +63,7 @@
 #include "MagickCore/profile.h"
 #include "MagickCore/property.h"
 #include "MagickCore/quantum-private.h"
+#include "MagickCore/semaphore.h"
 #include "MagickCore/static.h"
 #include "MagickCore/statistic.h"
 #include "MagickCore/string_.h"
@@ -96,7 +97,7 @@ static MagickBooleanType
 %
 %  The format of the IsJ2K method is:
 %
-%      MagickBooleanType IsJP2(const unsigned char *magick,const size_t length)
+%      MagickBooleanType IsJ2K(const unsigned char *magick,const size_t length)
 %
 %  A description of each parameter follows:
 %
@@ -157,44 +158,6 @@ static MagickBooleanType IsJP2(const unsigned char *magick,const size_t length)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   I s J P C                                                                 %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  IsJPC()() returns MagickTrue if the image format type, identified by the
-%  magick string, is JPC.
-%
-%  The format of the IsJPC method is:
-%
-%      MagickBooleanType IsJPC(const unsigned char *magick,const size_t length)
-%
-%  A description of each parameter follows:
-%
-%    o magick: compare image format pattern against these bytes.
-%
-%    o length: Specifies the length of the magick string.
-%
-*/
-static MagickBooleanType IsJPC(const unsigned char *magick,const size_t length)
-{
-  if (length < 4)
-    return(MagickFalse);
-  if (memcmp(magick,"\x0d\x0a\x87\x0a",4) == 0)
-    return(MagickTrue);
-  if (length < 12)
-    return(MagickFalse);
-  if (memcmp(magick,"\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a",12) == 0)
-    return(MagickTrue);
-  return(MagickFalse);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
 %   R e a d J P 2 I m a g e                                                   %
 %                                                                             %
 %                                                                             %
@@ -354,8 +317,7 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
   if (LocaleCompare(image_info->magick,"JPT") == 0)
     jp2_codec=opj_create_decompress(OPJ_CODEC_JPT);
   else
-    if (IsJ2K(sans,4) != MagickFalse || LocaleCompare(image_info->magick,
-        "J2K") == 0)
+    if (IsJ2K(sans,4) != MagickFalse)
       jp2_codec=opj_create_decompress(OPJ_CODEC_J2K);
     else
       jp2_codec=opj_create_decompress(OPJ_CODEC_JP2);
@@ -630,7 +592,7 @@ ModuleExport size_t RegisterJP2Image(void)
     entry->version=ConstantString(version);
   entry->mime_type=ConstantString("image/jp2");
   entry->module=ConstantString("JP2");
-  entry->magick=(IsImageFormatHandler *) IsJPC;
+  entry->magick=(IsImageFormatHandler *) IsJP2;
   entry->adjoin=MagickFalse;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
@@ -938,8 +900,7 @@ static MagickBooleanType WriteJP2Image(const ImageInfo *image_info,Image *image,
     }
   else
     {
-      if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
-        (void) TransformImageColorspace(image,sRGBColorspace,exception);
+      (void) TransformImageColorspace(image,sRGBColorspace,exception);
       if (IsGrayColorspace(image->colorspace) != MagickFalse)
         {
           channels=1;