From 7966a36446717818110498cc0a9f2d30d1d264a4 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 6 Dec 2010 11:10:19 +0000 Subject: [PATCH] bump plus oops --- ChangeLog | 3 ++ configure.in | 12 ++++---- libvips/format/im_jpeg2vips.c | 39 +++++++++++++++++++++++++- tools/scripts/Makefile.am | 4 +-- tools/scripts/{vips-7.24 => vips-7.25} | 0 vips-7.24.pc.in => vips-7.25.pc.in | 0 vipsCC-7.24.pc.in => vipsCC-7.25.pc.in | 0 7 files changed, 49 insertions(+), 9 deletions(-) rename tools/scripts/{vips-7.24 => vips-7.25} (100%) rename vips-7.24.pc.in => vips-7.25.pc.in (100%) rename vipsCC-7.24.pc.in => vipsCC-7.25.pc.in (100%) diff --git a/ChangeLog b/ChangeLog index 9f8277a9..3873e7c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +6/12/10 started 7.24.0 +- attach the jpeg thumbnail and multiscan fields (thanks Mike) + 30/11/10 started 7.24.0 - bump for new stable - added im_dmask2imask(), im_imask2dmask() diff --git a/configure.in b/configure.in index 872cd84f..bb3f9140 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_CONFIG_MACRO_DIR(m4) # user-visible library versioning m4_define([vips_major_version], [7]) -m4_define([vips_minor_version], [24]) +m4_define([vips_minor_version], [25]) m4_define([vips_micro_version], [0]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -28,9 +28,9 @@ PACKAGE=vips # interface changes backwards compatible?: increment age # interface changes not backwards compatible?: reset age to 0 -LIBRARY_CURRENT=29 -LIBRARY_REVISION=4 -LIBRARY_AGE=14 +LIBRARY_CURRENT=30 +LIBRARY_REVISION=0 +LIBRARY_AGE=15 AM_INIT_AUTOMAKE($PACKAGE,$VERSION) @@ -610,8 +610,8 @@ AC_SUBST(PACKAGES_USED) # vips-$IM_MAJOR_VERSION.$IM_MINOR_VERSION.pc # in AC_OUTPUT, but that seems to break for some combinations of sh/m4 AC_OUTPUT([ - vips-7.24.pc - vipsCC-7.24.pc + vips-7.25.pc + vipsCC-7.25.pc Makefile libvips/include/vips/version.h libvips/include/Makefile diff --git a/libvips/format/im_jpeg2vips.c b/libvips/format/im_jpeg2vips.c index 70760fc7..2c4ec26d 100644 --- a/libvips/format/im_jpeg2vips.c +++ b/libvips/format/im_jpeg2vips.c @@ -28,6 +28,8 @@ * - also set scale_num on shrink (thanks Guido) * 4/2/10 * - gtkdoc + * 4/12/10 + * - attach the jpeg thumbnail and multiscan fields (thanks Mike) */ /* @@ -370,12 +372,31 @@ set_vips_resolution( IMAGE *im, ExifData *ed ) im->Xres = xres; im->Yres = yres; } + +static int +attach_thumbnail( IMAGE *im, ExifData *ed ) +{ + if( ed->size > 0 ) { + char *thumb_copy; + + thumb_copy = im_malloc( NULL, ed->size ); + memcpy( thumb_copy, ed->data, ed->size ); + + if( im_meta_set_blob( im, "jpeg-thumbnail-data", + (im_callback_fn) im_free, thumb_copy, ed->size ) ) { + im_free( thumb_copy ); + return( -1 ); + } + } + + return( 0 ); +} #endif /*HAVE_EXIF*/ static int read_exif( IMAGE *im, void *data, int data_length ) { - char *data_copy; +char *data_copy; /* Always attach a copy of the unparsed exif data. */ @@ -416,6 +437,8 @@ read_exif( IMAGE *im, void *data, int data_length ) * xres/yres fields. */ set_vips_resolution( im, ed ); + + attach_thumbnail( im, ed ); } exif_data_free( ed ); @@ -484,6 +507,12 @@ read_jpeg_header( struct jpeg_decompress_struct *cinfo, IM_BBITS_BYTE, IM_BANDFMT_UCHAR, IM_CODING_NONE, type, 1.0, 1.0, 0, 0 ); + /* Interlaced jpegs need lots of memory to read, so our caller needs + * to know. + */ + (void) im_meta_set_int( out, "jpeg-multiscan", + jpeg_has_multiple_scans( cinfo ) ); + /* Look for EXIF and ICC profile. */ for( p = cinfo->marker_list; p; p = p->next ) { @@ -756,6 +785,14 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only ) * metadata. You need to use something like im_icc_import() to get CIE * values from the file. Any EXIF data is also attached as VIPS metadata. * + * The int metadata item "jpeg-multiscan" is set to the result of + * jpeg_has_multiple_scans(). Interlaced jpeg images need a large amount of + * memory to load, so this field gives callers a chance to handle these + * images differently. + * + * The EXIF thumbnail, if present, is attached to the image as + * "jpeg-thumbnail-data". See im_meta_get_blob(). + * * See also: #VipsFormat, im_vips2jpeg(). * * Returns: 0 on success, -1 on error. diff --git a/tools/scripts/Makefile.am b/tools/scripts/Makefile.am index 9377f9bb..87fab542 100644 --- a/tools/scripts/Makefile.am +++ b/tools/scripts/Makefile.am @@ -4,12 +4,12 @@ bin_SCRIPTS = \ batch_image_convert \ batch_rubber_sheet \ batch_crop \ - vips-7.24 + vips-7.25 noinst_SCRIPTS = post_install EXTRA_DIST = \ - vips-7.24 \ + vips-7.25 \ ${noinst_SCRIPTS} \ light_correct.in \ shrink_width.in \ diff --git a/tools/scripts/vips-7.24 b/tools/scripts/vips-7.25 similarity index 100% rename from tools/scripts/vips-7.24 rename to tools/scripts/vips-7.25 diff --git a/vips-7.24.pc.in b/vips-7.25.pc.in similarity index 100% rename from vips-7.24.pc.in rename to vips-7.25.pc.in diff --git a/vipsCC-7.24.pc.in b/vipsCC-7.25.pc.in similarity index 100% rename from vipsCC-7.24.pc.in rename to vipsCC-7.25.pc.in