remove the @format param to magickload
This commit is contained in:
parent
b7bac0d88d
commit
72f589764a
@ -15,7 +15,6 @@
|
|||||||
- use O_TMPFILE, if available [Alexander--]
|
- use O_TMPFILE, if available [Alexander--]
|
||||||
- set "interlaced=1" for interlaced JPG and PNG images
|
- set "interlaced=1" for interlaced JPG and PNG images
|
||||||
- add PDFium PDF loader
|
- add PDFium PDF loader
|
||||||
- add @format option to magickload
|
|
||||||
- jpegload adds a jpeg-chroma-subsample field with eg. 4:4:4 for no
|
- jpegload adds a jpeg-chroma-subsample field with eg. 4:4:4 for no
|
||||||
chrominance subsampling.
|
chrominance subsampling.
|
||||||
- tiffload, pdfload, magickload set VIPS_META_N_PAGES "n-pages" metadata item
|
- tiffload, pdfload, magickload set VIPS_META_N_PAGES "n-pages" metadata item
|
||||||
|
@ -55,8 +55,6 @@
|
|||||||
* - remove @all_frames, add @n
|
* - remove @all_frames, add @n
|
||||||
* 23/2/17
|
* 23/2/17
|
||||||
* - try using GetImageChannelDepth() instead of ->depth
|
* - try using GetImageChannelDepth() instead of ->depth
|
||||||
* 24/4/18
|
|
||||||
* - add format hint
|
|
||||||
* 25/5/18
|
* 25/5/18
|
||||||
* - don't use Ping, it's too unreliable
|
* - don't use Ping, it's too unreliable
|
||||||
*/
|
*/
|
||||||
@ -184,7 +182,7 @@ read_close( VipsImage *im, Read *read )
|
|||||||
|
|
||||||
static Read *
|
static Read *
|
||||||
read_new( const char *filename, VipsImage *im,
|
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;
|
Read *read;
|
||||||
|
|
||||||
@ -221,10 +219,14 @@ read_new( const char *filename, VipsImage *im,
|
|||||||
filename, MaxTextExtent );
|
filename, MaxTextExtent );
|
||||||
|
|
||||||
/* The file format hint, eg. "ICO".
|
/* The file format hint, eg. "ICO".
|
||||||
*/
|
*
|
||||||
if( format )
|
if( format )
|
||||||
vips_strncpy( read->image_info->magick,
|
vips_strncpy( read->image_info->magick,
|
||||||
format, MaxTextExtent );
|
format, MaxTextExtent );
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
printf( "magick2vips: insert format stuff here\n" );
|
||||||
|
|
||||||
|
|
||||||
/* Canvas resolution for rendering vector formats like SVG.
|
/* Canvas resolution for rendering vector formats like SVG.
|
||||||
*/
|
*/
|
||||||
@ -744,8 +746,7 @@ magick_fill_region( VipsRegion *out,
|
|||||||
|
|
||||||
int
|
int
|
||||||
vips__magick_read( const char *filename,
|
vips__magick_read( const char *filename,
|
||||||
VipsImage *out, const char *format, const char *density,
|
VipsImage *out, const char *density, int page, int n )
|
||||||
int page, int n )
|
|
||||||
{
|
{
|
||||||
Read *read;
|
Read *read;
|
||||||
|
|
||||||
@ -753,7 +754,7 @@ vips__magick_read( const char *filename,
|
|||||||
printf( "magick2vips: vips__magick_read: %s\n", filename );
|
printf( "magick2vips: vips__magick_read: %s\n", filename );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( !(read = read_new( filename, out, format, density, page, n )) )
|
if( !(read = read_new( filename, out, density, page, n )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -779,8 +780,7 @@ vips__magick_read( const char *filename,
|
|||||||
|
|
||||||
int
|
int
|
||||||
vips__magick_read_header( const char *filename,
|
vips__magick_read_header( const char *filename,
|
||||||
VipsImage *out, const char *format, const char *density,
|
VipsImage *out, const char *density, int page, int n )
|
||||||
int page, int n )
|
|
||||||
{
|
{
|
||||||
Read *read;
|
Read *read;
|
||||||
|
|
||||||
@ -788,7 +788,7 @@ vips__magick_read_header( const char *filename,
|
|||||||
printf( "vips__magick_read_header: %s\n", filename );
|
printf( "vips__magick_read_header: %s\n", filename );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( !(read = read_new( filename, out, format, density, page, n )) )
|
if( !(read = read_new( filename, out, density, page, n )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -825,8 +825,7 @@ vips__magick_read_header( const char *filename,
|
|||||||
|
|
||||||
int
|
int
|
||||||
vips__magick_read_buffer( const void *buf, const size_t len,
|
vips__magick_read_buffer( const void *buf, const size_t len,
|
||||||
VipsImage *out, const char *format, const char *density,
|
VipsImage *out, const char *density, int page, int n )
|
||||||
int page, int n )
|
|
||||||
{
|
{
|
||||||
Read *read;
|
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 );
|
printf( "magick2vips: vips__magick_read_buffer: %p %zu\n", buf, len );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( !(read = read_new( NULL, out, format, density, page, n )) )
|
if( !(read = read_new( NULL, out, density, page, n )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -860,8 +859,7 @@ vips__magick_read_buffer( const void *buf, const size_t len,
|
|||||||
|
|
||||||
int
|
int
|
||||||
vips__magick_read_buffer_header( const void *buf, const size_t len,
|
vips__magick_read_buffer_header( const void *buf, const size_t len,
|
||||||
VipsImage *out, const char *format, const char *density,
|
VipsImage *out, const char *density, int page, int n )
|
||||||
int page, int n )
|
|
||||||
{
|
{
|
||||||
Read *read;
|
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 );
|
printf( "vips__magick_read_buffer_header: %p %zu\n", buf, len );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( !(read = read_new( NULL, out, format, density, page, n )) )
|
if( !(read = read_new( NULL, out, density, page, n )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
* - from magickload
|
* - from magickload
|
||||||
* 25/11/16
|
* 25/11/16
|
||||||
* - add @n, deprecate @all_frames (just sets n = -1)
|
* - 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;
|
gboolean all_frames;
|
||||||
|
|
||||||
char *format; /* Format hint */
|
|
||||||
char *density; /* Load at this resolution */
|
char *density; /* Load at this resolution */
|
||||||
int page; /* Load this page (frame) */
|
int page; /* Load this page (frame) */
|
||||||
int n; /* Load this many pages */
|
int n; /* Load this many pages */
|
||||||
@ -309,10 +306,12 @@ vips_foreign_load_magick7_build( VipsObject *object )
|
|||||||
magick7->n = -1;
|
magick7->n = -1;
|
||||||
|
|
||||||
/* The file format hint, eg. "ICO".
|
/* The file format hint, eg. "ICO".
|
||||||
*/
|
*
|
||||||
if( magick7->format )
|
if( magick7->format )
|
||||||
vips_strncpy( magick7->image_info->magick,
|
vips_strncpy( magick7->image_info->magick,
|
||||||
magick7->format, MaxTextExtent );
|
magick7->format, MaxTextExtent );
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/* Canvas resolution for rendering vector formats like SVG.
|
/* 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;
|
vips_foreign_load_magick7_get_flags_filename;
|
||||||
load_class->get_flags = vips_foreign_load_magick7_get_flags;
|
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,
|
VIPS_ARG_STRING( class, "density", 4,
|
||||||
_( "Density" ),
|
_( "Density" ),
|
||||||
_( "Canvas resolution for rendering vector formats like SVG" ),
|
_( "Canvas resolution for rendering vector formats like SVG" ),
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
* - add @n, deprecate @all_frames (just sets n = -1)
|
* - add @n, deprecate @all_frames (just sets n = -1)
|
||||||
* 8/9/17
|
* 8/9/17
|
||||||
* - don't cache magickload
|
* - don't cache magickload
|
||||||
* 24/4/18
|
|
||||||
* - add format hint
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -74,7 +72,6 @@ typedef struct _VipsForeignLoadMagick {
|
|||||||
gboolean all_frames;
|
gboolean all_frames;
|
||||||
|
|
||||||
char *density; /* Load at this resolution */
|
char *density; /* Load at this resolution */
|
||||||
char *format; /* Load format hint */
|
|
||||||
int page; /* Load this page (frame) */
|
int page; /* Load this page (frame) */
|
||||||
int n; /* Load this many pages */
|
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;
|
vips_foreign_load_magick_get_flags_filename;
|
||||||
load_class->get_flags = vips_foreign_load_magick_get_flags;
|
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,
|
VIPS_ARG_BOOL( class, "all_frames", 4,
|
||||||
_( "all_frames" ),
|
_( "all_frames" ),
|
||||||
_( "Read all frames from an image" ),
|
_( "Read all frames from an image" ),
|
||||||
@ -187,7 +177,7 @@ ismagick( const char *filename )
|
|||||||
|
|
||||||
t = vips_image_new();
|
t = vips_image_new();
|
||||||
vips_error_freeze();
|
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 );
|
g_object_unref( t );
|
||||||
vips_error_thaw();
|
vips_error_thaw();
|
||||||
|
|
||||||
@ -212,7 +202,7 @@ vips_foreign_load_magick_file_header( VipsForeignLoad *load )
|
|||||||
magick->n = -1;
|
magick->n = -1;
|
||||||
|
|
||||||
if( vips__magick_read( magick_file->filename,
|
if( vips__magick_read( magick_file->filename,
|
||||||
load->out, magick->format, magick->density,
|
load->out, magick->density,
|
||||||
magick->page, magick->n ) )
|
magick->page, magick->n ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
@ -273,8 +263,7 @@ vips_foreign_load_magick_buffer_is_a_buffer( const void *buf, size_t len )
|
|||||||
|
|
||||||
t = vips_image_new();
|
t = vips_image_new();
|
||||||
vips_error_freeze();
|
vips_error_freeze();
|
||||||
result = vips__magick_read_buffer_header( buf, len, t,
|
result = vips__magick_read_buffer_header( buf, len, t, NULL, 0, 1 );
|
||||||
NULL, NULL, 0, 1 );
|
|
||||||
g_object_unref( t );
|
g_object_unref( t );
|
||||||
vips_error_thaw();
|
vips_error_thaw();
|
||||||
|
|
||||||
@ -300,7 +289,7 @@ vips_foreign_load_magick_buffer_header( VipsForeignLoad *load )
|
|||||||
|
|
||||||
if( vips__magick_read_buffer(
|
if( vips__magick_read_buffer(
|
||||||
magick_buffer->buf->data, magick_buffer->buf->length,
|
magick_buffer->buf->data, magick_buffer->buf->length,
|
||||||
load->out, magick->format, magick->density, magick->page,
|
load->out, magick->density, magick->page,
|
||||||
magick->n ) )
|
magick->n ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
@ -351,7 +340,6 @@ vips_foreign_load_magick_buffer_init( VipsForeignLoadMagickBuffer *buffer )
|
|||||||
*
|
*
|
||||||
* Optional arguments:
|
* Optional arguments:
|
||||||
*
|
*
|
||||||
* * @format: string, format hint, eg. "JPG"
|
|
||||||
* * @page: %gint, load from this page
|
* * @page: %gint, load from this page
|
||||||
* * @n: %gint, load this many pages
|
* * @n: %gint, load this many pages
|
||||||
* * @density: string, canvas resolution for rendering vector formats like SVG
|
* * @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
|
* The reader should also work with most versions of GraphicsMagick. See the
|
||||||
* "--with-magickpackage" configure option.
|
* "--with-magickpackage" configure option.
|
||||||
*
|
*
|
||||||
* The file format is usually guessed from the filename suffix. You can
|
* The file format is usually guessed from the filename suffix, or sniffed
|
||||||
* override this with @format -- for example `"ICO"` selects Windows icon
|
* from the file contents.
|
||||||
* format. See the ImageMagick documentation for a list of format names.
|
|
||||||
*
|
*
|
||||||
* Normally it will only load the first image in a many-image sequence (such
|
* 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
|
* 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:
|
* Optional arguments:
|
||||||
*
|
*
|
||||||
* * @format: string, format hint, eg. "JPG"
|
|
||||||
* * @page: %gint, load from this page
|
* * @page: %gint, load from this page
|
||||||
* * @n: %gint, load this many pages
|
* * @n: %gint, load this many pages
|
||||||
* * @density: string, canvas resolution for rendering vector formats like SVG
|
* * @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
|
* Read an image memory block using libMagick into a VIPS image. Exactly as
|
||||||
* vips_magickload(), but read from a memory source.
|
* 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
|
* You must not free the buffer while @out is active. The
|
||||||
* #VipsObject::postclose signal on @out is a good place to free.
|
* #VipsObject::postclose signal on @out is a good place to free.
|
||||||
*
|
*
|
||||||
|
@ -135,18 +135,14 @@ int vips__fits_read( const char *filename, VipsImage *out );
|
|||||||
int vips__fits_write( VipsImage *in, const char *filename );
|
int vips__fits_write( VipsImage *in, const char *filename );
|
||||||
|
|
||||||
int vips__magick_read( const char *filename,
|
int vips__magick_read( const char *filename,
|
||||||
VipsImage *out, const char *format, const char *density,
|
VipsImage *out, const char *density, int page, int n );
|
||||||
int page, int n );
|
|
||||||
int vips__magick_read_header( const char *filename,
|
int vips__magick_read_header( const char *filename,
|
||||||
VipsImage *out, const char *format, const char *density,
|
VipsImage *out, const char *density, int page, int n );
|
||||||
int page, int n );
|
|
||||||
|
|
||||||
int vips__magick_read_buffer( const void *buf, const size_t len,
|
int vips__magick_read_buffer( const void *buf, const size_t len,
|
||||||
VipsImage *out, const char *format, const char *density,
|
VipsImage *out, const char *density, int page, int n );
|
||||||
int page, int n );
|
|
||||||
int vips__magick_read_buffer_header( 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,
|
VipsImage *out, const char *density, int page, int n );
|
||||||
int page, int n );
|
|
||||||
|
|
||||||
extern const char *vips__mat_suffs[];
|
extern const char *vips__mat_suffs[];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user