fix the magick loader

see
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20017
This commit is contained in:
John Cupitt 2012-01-17 15:29:39 +00:00
parent 71fed4a614
commit 4311fa71da
3 changed files with 22 additions and 36 deletions

33
TODO
View File

@ -6,22 +6,6 @@
- why is the cache operation only? it'd be useful to cache things like
interpolate as well, wouldn't it?
- perhaps Xsize and Ysize should become gint64
eg. easy to make an image that's 3gb and has xsize == 1 ... death!
also bands I guess
now everything that iterates over a dimension must be gint64 too
- Vips.Image has members like chain, __subclasshook__ etc etc, are we
really subclassing it correctly?
@ -48,23 +32,6 @@
- magickload is broken
$ vips magickload healthygirl.jpg x.v
VipsRegion: inappropriate region type
VipsRegion: inappropriate region type
VipsImage: file has been truncated
seems to be a magick bug: ping jpg reports 1 band, load jpg reports 3 band
posted a question, wait for reply ... useless
look at what PingImage() actually does for jpg images
- how about
vips max add[babe.jpg,babe2.jpg]

View File

@ -67,8 +67,8 @@
*/
/* Turn on debugging output.
*/
#define DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -676,6 +676,12 @@ vips__magick_read( const char *filename, VipsImage *out )
return( 0 );
}
/* This has severe issues. See:
*
* http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20017
*
* Don't use.
*/
int
vips__magick_read_header( const char *filename, VipsImage *im )
{

View File

@ -2,6 +2,8 @@
*
* 5/12/11
* - from openslideload.c
* 17/1/12
* - remove header-only loads
*/
/*
@ -95,6 +97,11 @@ vips_foreign_load_magick_get_flags( VipsForeignLoad *load )
magick->filename ) );
}
/*
* Unfortunately, libMagick does not support header-only reads very well. See
*
* http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20017
*
static int
vips_foreign_load_magick_header( VipsForeignLoad *load )
{
@ -105,13 +112,14 @@ vips_foreign_load_magick_header( VipsForeignLoad *load )
return( 0 );
}
*/
static int
vips_foreign_load_magick_load( VipsForeignLoad *load )
{
VipsForeignLoadMagick *magick = (VipsForeignLoadMagick *) load;
if( vips__magick_read( magick->filename, load->real ) )
if( vips__magick_read( magick->filename, load->out ) )
return( -1 );
return( 0 );
@ -132,7 +140,7 @@ vips_foreign_load_magick_class_init( VipsForeignLoadMagickClass *class )
object_class->description = _( "load file with ImageMagick" );
/* We need to be well to the back of the queue since the vips's
* dedicated loaders are usually preferable, if possible.
* dedicated loaders are usually preferable.
*/
foreign_class->priority = -100;
@ -140,8 +148,13 @@ vips_foreign_load_magick_class_init( VipsForeignLoadMagickClass *class )
load_class->get_flags_filename =
vips_foreign_load_magick_get_flags_filename;
load_class->get_flags = vips_foreign_load_magick_get_flags;
load_class->header = vips_foreign_load_magick_load;
/* See comment above.
*
load_class->header = vips_foreign_load_magick_header;
load_class->load = vips_foreign_load_magick_load;
*/
VIPS_ARG_STRING( class, "filename", 1,
_( "Filename" ),