{ "IPTC", 0, MagickString("\034\002") },
{ "JNG", 0, MagickString("\213JNG\r\n\032\n") },
{ "JPEG", 0, MagickString("\377\330\377") },
- { "JPC", 0, MagickString("\377\117") },
- { "JP2", 4, MagickString("\152\120\040\040\015") },
+ { "J2K", 0, MagickString("\xff\x4f\xff\x51") },
+ { "JPC", 0, MagickString("\x0d\x0a\x87\x0a") },
+ { "JP2", 4, MagickString("\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a") },
{ "MAT", 0, MagickString("MATLAB 5.0 MAT-file,") },
{ "MIFF", 0, MagickString("Id=ImageMagick") },
{ "MIFF", 0, MagickString("id=ImageMagick") },
% %
% %
% %
+% I s J 2 K %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% IsJ2K() returns MagickTrue if the image format type, identified by the
+% magick string, is J2K.
+%
+% The format of the IsJ2K method is:
+%
+% MagickBooleanType IsJP2(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 IsJ2K(const unsigned char *magick,const size_t length)
+{
+ if (length < 4)
+ return(MagickFalse);
+ if (memcmp(magick,"\xff\x4f\xff\x51",4) == 0)
+ return(MagickTrue);
+ return(MagickFalse);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% I s J P 2 %
% %
% %
*/
static MagickBooleanType IsJP2(const unsigned char *magick,const size_t length)
{
- if (length < 9)
+ if (length < 12)
return(MagickFalse);
- if (memcmp(magick+4,"\152\120\040\040\015",5) == 0)
+ if (memcmp(magick,"\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a",12) == 0)
+ return(MagickTrue);
+ if (memcmp(magick,"\x0d\x0a\x87\x0a",12) == 0)
return(MagickTrue);
return(MagickFalse);
}
*/
static MagickBooleanType IsJPC(const unsigned char *magick,const size_t length)
{
- if (length < 2)
+ if (length < 12)
return(MagickFalse);
- if (memcmp(magick,"\377\117",2) == 0)
+ if (memcmp(magick,"\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a",12) == 0)
+ return(MagickTrue);
+ if (memcmp(magick,"\x0d\x0a\x87\x0a",12) == 0)
return(MagickTrue);
return(MagickFalse);
}
entry->description=ConstantString("JPEG-2000 Code Stream Syntax");
entry->mime_type=ConstantString("image/jp2");
entry->module=ConstantString("JP2");
- entry->magick=(IsImageFormatHandler *) IsJPC;
+ entry->magick=(IsImageFormatHandler *) IsJ2K;
entry->adjoin=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->thread_support=NoThreadSupport;