remove the @format param to magickload

This commit is contained in:
John Cupitt 2018-07-24 17:03:38 +01:00
parent b7bac0d88d
commit 72f589764a
5 changed files with 27 additions and 62 deletions

View File

@ -15,7 +15,6 @@
- use O_TMPFILE, if available [Alexander--]
- set "interlaced=1" for interlaced JPG and PNG images
- add PDFium PDF loader
- add @format option to magickload
- jpegload adds a jpeg-chroma-subsample field with eg. 4:4:4 for no
chrominance subsampling.
- tiffload, pdfload, magickload set VIPS_META_N_PAGES "n-pages" metadata item

View File

@ -55,8 +55,6 @@
* - remove @all_frames, add @n
* 23/2/17
* - try using GetImageChannelDepth() instead of ->depth
* 24/4/18
* - add format hint
* 25/5/18
* - don't use Ping, it's too unreliable
*/
@ -184,7 +182,7 @@ read_close( VipsImage *im, Read *read )
static Read *
read_new( const char *filename, VipsImage *im,
const char *format, const char *density, int page, int n )
const char *density, int page, int n )
{
Read *read;
@ -221,10 +219,14 @@ read_new( const char *filename, VipsImage *im,
filename, MaxTextExtent );
/* The file format hint, eg. "ICO".
*/
*
if( format )
vips_strncpy( read->image_info->magick,
format, MaxTextExtent );
*
*/
printf( "magick2vips: insert format stuff here\n" );
/* Canvas resolution for rendering vector formats like SVG.
*/
@ -744,8 +746,7 @@ magick_fill_region( VipsRegion *out,
int
vips__magick_read( const char *filename,
VipsImage *out, const char *format, const char *density,
int page, int n )
VipsImage *out, const char *density, int page, int n )
{
Read *read;
@ -753,7 +754,7 @@ vips__magick_read( const char *filename,
printf( "magick2vips: vips__magick_read: %s\n", filename );
#endif /*DEBUG*/
if( !(read = read_new( filename, out, format, density, page, n )) )
if( !(read = read_new( filename, out, density, page, n )) )
return( -1 );
#ifdef DEBUG
@ -779,8 +780,7 @@ vips__magick_read( const char *filename,
int
vips__magick_read_header( const char *filename,
VipsImage *out, const char *format, const char *density,
int page, int n )
VipsImage *out, const char *density, int page, int n )
{
Read *read;
@ -788,7 +788,7 @@ vips__magick_read_header( const char *filename,
printf( "vips__magick_read_header: %s\n", filename );
#endif /*DEBUG*/
if( !(read = read_new( filename, out, format, density, page, n )) )
if( !(read = read_new( filename, out, density, page, n )) )
return( -1 );
#ifdef DEBUG
@ -825,8 +825,7 @@ vips__magick_read_header( const char *filename,
int
vips__magick_read_buffer( const void *buf, const size_t len,
VipsImage *out, const char *format, const char *density,
int page, int n )
VipsImage *out, const char *density, int page, int n )
{
Read *read;
@ -834,7 +833,7 @@ vips__magick_read_buffer( const void *buf, const size_t len,
printf( "magick2vips: vips__magick_read_buffer: %p %zu\n", buf, len );
#endif /*DEBUG*/
if( !(read = read_new( NULL, out, format, density, page, n )) )
if( !(read = read_new( NULL, out, density, page, n )) )
return( -1 );
#ifdef DEBUG
@ -860,8 +859,7 @@ vips__magick_read_buffer( const void *buf, const size_t len,
int
vips__magick_read_buffer_header( const void *buf, const size_t len,
VipsImage *out, const char *format, const char *density,
int page, int n )
VipsImage *out, const char *density, int page, int n )
{
Read *read;
@ -869,7 +867,7 @@ vips__magick_read_buffer_header( const void *buf, const size_t len,
printf( "vips__magick_read_buffer_header: %p %zu\n", buf, len );
#endif /*DEBUG*/
if( !(read = read_new( NULL, out, format, density, page, n )) )
if( !(read = read_new( NULL, out, density, page, n )) )
return( -1 );
#ifdef DEBUG

View File

@ -4,8 +4,6 @@
* - from magickload
* 25/11/16
* - add @n, deprecate @all_frames (just sets n = -1)
* 24/4/18
* - add format hint
*/
/*
@ -67,7 +65,6 @@ typedef struct _VipsForeignLoadMagick7 {
*/
gboolean all_frames;
char *format; /* Format hint */
char *density; /* Load at this resolution */
int page; /* Load this page (frame) */
int n; /* Load this many pages */
@ -309,10 +306,12 @@ vips_foreign_load_magick7_build( VipsObject *object )
magick7->n = -1;
/* The file format hint, eg. "ICO".
*/
*
if( magick7->format )
vips_strncpy( magick7->image_info->magick,
magick7->format, MaxTextExtent );
*
*/
/* Canvas resolution for rendering vector formats like SVG.
*/
@ -364,13 +363,6 @@ vips_foreign_load_magick7_class_init( VipsForeignLoadMagick7Class *class )
vips_foreign_load_magick7_get_flags_filename;
load_class->get_flags = vips_foreign_load_magick7_get_flags;
VIPS_ARG_STRING( class, "format", 3,
_( "Format" ),
_( "Image format hint" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignLoadMagick7, format ),
NULL );
VIPS_ARG_STRING( class, "density", 4,
_( "Density" ),
_( "Canvas resolution for rendering vector formats like SVG" ),

View File

@ -12,8 +12,6 @@
* - add @n, deprecate @all_frames (just sets n = -1)
* 8/9/17
* - don't cache magickload
* 24/4/18
* - add format hint
*/
/*
@ -74,7 +72,6 @@ typedef struct _VipsForeignLoadMagick {
gboolean all_frames;
char *density; /* Load at this resolution */
char *format; /* Load format hint */
int page; /* Load this page (frame) */
int n; /* Load this many pages */
@ -125,13 +122,6 @@ vips_foreign_load_magick_class_init( VipsForeignLoadMagickClass *class )
vips_foreign_load_magick_get_flags_filename;
load_class->get_flags = vips_foreign_load_magick_get_flags;
VIPS_ARG_STRING( class, "format", 3,
_( "Format" ),
_( "Image format hint" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignLoadMagick, format ),
NULL );
VIPS_ARG_BOOL( class, "all_frames", 4,
_( "all_frames" ),
_( "Read all frames from an image" ),
@ -187,7 +177,7 @@ ismagick( const char *filename )
t = vips_image_new();
vips_error_freeze();
result = vips__magick_read_header( filename, t, NULL, NULL, 0, 1 );
result = vips__magick_read_header( filename, t, NULL, 0, 1 );
g_object_unref( t );
vips_error_thaw();
@ -212,7 +202,7 @@ vips_foreign_load_magick_file_header( VipsForeignLoad *load )
magick->n = -1;
if( vips__magick_read( magick_file->filename,
load->out, magick->format, magick->density,
load->out, magick->density,
magick->page, magick->n ) )
return( -1 );
@ -273,8 +263,7 @@ vips_foreign_load_magick_buffer_is_a_buffer( const void *buf, size_t len )
t = vips_image_new();
vips_error_freeze();
result = vips__magick_read_buffer_header( buf, len, t,
NULL, NULL, 0, 1 );
result = vips__magick_read_buffer_header( buf, len, t, NULL, 0, 1 );
g_object_unref( t );
vips_error_thaw();
@ -300,7 +289,7 @@ vips_foreign_load_magick_buffer_header( VipsForeignLoad *load )
if( vips__magick_read_buffer(
magick_buffer->buf->data, magick_buffer->buf->length,
load->out, magick->format, magick->density, magick->page,
load->out, magick->density, magick->page,
magick->n ) )
return( -1 );
@ -351,7 +340,6 @@ vips_foreign_load_magick_buffer_init( VipsForeignLoadMagickBuffer *buffer )
*
* Optional arguments:
*
* * @format: string, format hint, eg. "JPG"
* * @page: %gint, load from this page
* * @n: %gint, load this many pages
* * @density: string, canvas resolution for rendering vector formats like SVG
@ -366,9 +354,8 @@ vips_foreign_load_magick_buffer_init( VipsForeignLoadMagickBuffer *buffer )
* The reader should also work with most versions of GraphicsMagick. See the
* "--with-magickpackage" configure option.
*
* The file format is usually guessed from the filename suffix. You can
* override this with @format -- for example `"ICO"` selects Windows icon
* format. See the ImageMagick documentation for a list of format names.
* The file format is usually guessed from the filename suffix, or sniffed
* from the file contents.
*
* Normally it will only load the first image in a many-image sequence (such
* as a GIF or a PDF). Use @page and @n to set the start page and number of
@ -405,7 +392,6 @@ vips_magickload( const char *filename, VipsImage **out, ... )
*
* Optional arguments:
*
* * @format: string, format hint, eg. "JPG"
* * @page: %gint, load from this page
* * @n: %gint, load this many pages
* * @density: string, canvas resolution for rendering vector formats like SVG
@ -413,12 +399,6 @@ vips_magickload( const char *filename, VipsImage **out, ... )
* Read an image memory block using libMagick into a VIPS image. Exactly as
* vips_magickload(), but read from a memory source.
*
* The file format is usually guessed from the buffer contents, but this does
* not work for all image formats. You can
* set the format explicitly with @format -- for example `"ICO"` selects
* Windows icon
* format. See the ImageMagick documentation for a list of format names.
*
* You must not free the buffer while @out is active. The
* #VipsObject::postclose signal on @out is a good place to free.
*

View File

@ -135,18 +135,14 @@ int vips__fits_read( const char *filename, VipsImage *out );
int vips__fits_write( VipsImage *in, const char *filename );
int vips__magick_read( const char *filename,
VipsImage *out, const char *format, const char *density,
int page, int n );
VipsImage *out, const char *density, int page, int n );
int vips__magick_read_header( const char *filename,
VipsImage *out, const char *format, const char *density,
int page, int n );
VipsImage *out, const char *density, int page, int n );
int vips__magick_read_buffer( const void *buf, const size_t len,
VipsImage *out, const char *format, const char *density,
int page, int n );
VipsImage *out, const char *density, int page, int n );
int vips__magick_read_buffer_header( const void *buf, const size_t len,
VipsImage *out, const char *format, const char *density,
int page, int n );
VipsImage *out, const char *density, int page, int n );
extern const char *vips__mat_suffs[];