don't use Ping in magickload
it's too unreliable :-( we are forced to read every time
This commit is contained in:
parent
d251b37d92
commit
0486218ff5
@ -22,7 +22,6 @@
|
||||
- add fontfile option to vips_text() [fangqiao]
|
||||
- add vips_transpose3d() -- swap major dimensions in a volumetric image
|
||||
- remove vips7 stuff from default API ... you must now #include it explicitly
|
||||
- acquire an image colormap if none set [jtorresfabra]
|
||||
- added vips_argument_get_id() to fix derived classes on win32 [angelmixu]
|
||||
|
||||
12/3/18 started 8.6.4
|
||||
|
11
configure.ac
11
configure.ac
@ -704,17 +704,6 @@ if test x"$magick6" = x"yes"; then
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
if test x"$magick6" = x"yes"; then
|
||||
# more recent magick6s have AcquireImageColormap rather than
|
||||
# AllocateImageColormap groan
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $MAGICK_LIBS"
|
||||
AC_CHECK_FUNCS(AcquireImageColormap,
|
||||
AC_DEFINE(HAVE_ACQUIREIMAGECOLORMAP,1,
|
||||
[define if your magick has AcquireImageColormap.]))
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
if test x"$magick6" = x"yes"; then
|
||||
# more recent magick6s have SetImageExtent
|
||||
save_LIBS="$LIBS"
|
||||
|
@ -52,12 +52,6 @@ magick_acquire_image( const ImageInfo *image_info, ExceptionInfo *exception )
|
||||
return( AcquireImage( image_info, exception ) );
|
||||
}
|
||||
|
||||
void
|
||||
magick_acquire_image_colormap( Image *image, int colors )
|
||||
{
|
||||
AcquireImageColormap( image, colors )
|
||||
}
|
||||
|
||||
void
|
||||
magick_acquire_next_image( const ImageInfo *image_info, Image *image,
|
||||
ExceptionInfo *exception )
|
||||
@ -113,16 +107,6 @@ magick_acquire_image( const ImageInfo *image_info, ExceptionInfo *exception )
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
magick_acquire_image_colormap( Image *image, int colors )
|
||||
{
|
||||
#ifdef HAVE_ACQUIREIMAGECOLORMAP
|
||||
AcquireImageColormap( image, colors );
|
||||
#else /*!HAVE_ACQUIREIMAGECOLORMAP*/
|
||||
AllocateImageColormap( image, colors );
|
||||
#endif /*HAVE_ACQUIREIMAGECOLORMAP*/
|
||||
}
|
||||
|
||||
void
|
||||
magick_acquire_next_image( const ImageInfo *image_info, Image *image,
|
||||
ExceptionInfo *exception )
|
||||
|
@ -44,7 +44,6 @@
|
||||
|
||||
Image *magick_acquire_image( const ImageInfo *image_info,
|
||||
ExceptionInfo *exception );
|
||||
void magick_acquire_image_colormap( Image *image, int colors );
|
||||
void magick_acquire_next_image( const ImageInfo *image_info,
|
||||
Image *image, ExceptionInfo *exception );
|
||||
int magick_set_image_size( Image *image,
|
||||
|
@ -58,7 +58,7 @@
|
||||
* 24/4/18
|
||||
* - add format hint
|
||||
* 25/5/18
|
||||
* - acquire an image colormap if none set
|
||||
* - don't use Ping, it's too unreliable
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -329,15 +329,6 @@ parse_header( Read *read )
|
||||
if( (im->Bands = get_bands( image )) < 0 )
|
||||
return( -1 );
|
||||
|
||||
/* Some ImageMagick loaders (eg. TGA) fail to set the ->colormap
|
||||
* field on Ping. GetImageChannelDepth() needs this and
|
||||
* will crash if it's not set.
|
||||
*
|
||||
* If there's no colormap, set an empty one.
|
||||
*/
|
||||
if( !image->colormap )
|
||||
magick_acquire_image_colormap( image, image->colors );
|
||||
|
||||
/* Depth can be 'fractional'.
|
||||
*
|
||||
* You'd think we should use
|
||||
@ -786,10 +777,6 @@ vips__magick_read( const char *filename,
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* This has severe issues. See:
|
||||
*
|
||||
* http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20017
|
||||
*/
|
||||
int
|
||||
vips__magick_read_header( const char *filename,
|
||||
VipsImage *out, const char *format, const char *density,
|
||||
@ -805,14 +792,18 @@ vips__magick_read_header( const char *filename,
|
||||
return( -1 );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips__magick_read_header: pinging image ...\n" );
|
||||
printf( "vips__magick_read_header: reading image ...\n" );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
read->image = PingImage( read->image_info, &read->exception );
|
||||
/* It would be great if we could PingImage and just read the header,
|
||||
* but sadly many IM coders do not support ping. The critical one for
|
||||
* us is DICOM. TGA also has issues.
|
||||
*/
|
||||
read->image = ReadImage( read->image_info, &read->exception );
|
||||
if( !read->image ) {
|
||||
magick_vips_error( "magick2vips", &read->exception );
|
||||
vips_error( "magick2vips",
|
||||
_( "unable to ping file \"%s\"" ), filename );
|
||||
_( "unable to read file \"%s\"" ), filename );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
@ -885,7 +876,12 @@ vips__magick_read_buffer_header( const void *buf, const size_t len,
|
||||
printf( "vips__magick_read_buffer_header: pinging blob ...\n" );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
read->image = PingBlob( read->image_info, buf, len, &read->exception );
|
||||
/* It would be great if we could PingBlob and just read the header,
|
||||
* but sadly many IM coders do not support ping well. The critical one
|
||||
* for us is DICOM. TGA also has issues.
|
||||
*/
|
||||
read->image = BlobToImage( read->image_info,
|
||||
buf, len, &read->exception );
|
||||
if( !read->image ) {
|
||||
magick_vips_error( "magick2vips", &read->exception );
|
||||
vips_error( "magick2vips", "%s", _( "unable to ping blob" ) );
|
||||
|
Loading…
Reference in New Issue
Block a user