diff --git a/ChangeLog b/ChangeLog index 9a2c61ee..3d3a0182 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 12/3/13 started 7.33.0 +- vipsthumbnail lets you specify the sharpening mask 16/4/13 started 7.32.3 - rename GETTEXT_PACKAGE as vips7.32 to help Debian (thanks Jay) diff --git a/TODO b/TODO index 7680ae47..9ece20c6 100644 --- a/TODO +++ b/TODO @@ -1,30 +1,3 @@ -- try - - $ vips shrink Chicago.png x.png 228 228 --vips-progress - vips temp-4: 4 threads, 128 x 16 tiles, groups of 1280 scanlines - ** - VIPS:ERROR:vipspng.c:431:png2vips_generate: assertion failed: (r->top - == read->y_pos) - $ - - but - - $ vipsthumbnail Chicago.png - memory: high-water mark 66.96 MB - john@bambam ~/pics $ vipsthumbnail Chicago.png --verbose - thumbnailing Chicago.png - detected format as png - thumbnailing Chicago.png as ./tn_Chicago.jpg - integer shrink by 228 - residual scale by 1 - bilinear interpolation - sharpening thumbnail - memory: high-water mark 66.96 MB - $ - - is the extra cache that vipsthumbnail adds essential now? does that mean - that the mediawiki scalr can never work? - - look at diff --git a/man/vipsthumbnail.1 b/man/vipsthumbnail.1 index 29a33fb3..8bbc9f3e 100644 --- a/man/vipsthumbnail.1 +++ b/man/vipsthumbnail.1 @@ -33,15 +33,6 @@ will read image file and write a 64 x 64 pixel thumbnail to the file .B thumbnails/fred.png. -On Unix machines, vips -will create temporary files in "/tmp" by default. Use the environment variable -TMPDIR to change this location. On Windows, vips uses GetTempPath() to pick a -location, see the MS documentation. - -Use the --vips-disc-threshold command-line switch, or the IM_DISC_THRESHOLD -environment variable, to make vipsthumbnail use memory rather than temporary -files. - .SH OPTIONS .TP .B -s N, --size=N @@ -77,11 +68,15 @@ to see a list of valid interpolators. The default is .B bilinear. .TP -.B -n, --nosharpen -By default, -.B vipsthumbnail(1) -will sharpen thumbnails slightly to make them look more pleasing. This option -disables this sharpening. +.B -r, --sharpen=MASKFILE +Images can look a little soft after shrinking. This option lets you specify a +sharpening mask. Use "mild" to select a built-in mask which sharpens slightly. +The built-in mask is: + + 3 3 24 0 + -1 -1 -1 + -1 32 -1 + -1 -1 -1 .TP .B -e PROFILE, --eprofile=PROFILE @@ -101,11 +96,9 @@ should be supplied with the option. .TP -.B -l, --nodelete -Don't delete the profile from the output image. Since all output images will -generally have the same profile, -.B vipsthumbnail(1) -will usually delete it. This option leaves the profile inside the image. +.B -d, --delete +Delete the output profile from the image. This can save a small amount of +space. .TP .B -v, --verbose diff --git a/po/vips7.32.pot b/po/vips7.32.pot index 7f983c0d..77363755 100644 --- a/po/vips7.32.pot +++ b/po/vips7.32.pot @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" "product=glib&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2013-04-16 14:14+0100\n" +"POT-Creation-Date: 2013-04-26 12:32+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -185,7 +185,7 @@ msgstr "" #: ../libvips/conversion/extract.c:360 ../libvips/conversion/bandjoin.c:172 #: ../libvips/conversion/bandbool.c:212 ../libvips/conversion/copy.c:322 #: ../libvips/conversion/rot.c:360 ../libvips/conversion/replicate.c:197 -#: ../libvips/conversion/tilecache.c:392 ../libvips/conversion/embed.c:551 +#: ../libvips/conversion/tilecache.c:400 ../libvips/conversion/embed.c:551 #: ../libvips/conversion/cache.c:101 ../libvips/conversion/recomb.c:205 #: ../libvips/conversion/sequential.c:304 ../libvips/foreign/foreign.c:1361 #: ../libvips/resample/resample.c:90 @@ -389,7 +389,7 @@ msgstr "" #: ../libvips/conversion/flatten.c:378 ../libvips/conversion/extract.c:201 #: ../libvips/conversion/extract.c:361 ../libvips/conversion/copy.c:323 #: ../libvips/conversion/rot.c:361 ../libvips/conversion/replicate.c:198 -#: ../libvips/conversion/tilecache.c:393 ../libvips/conversion/embed.c:552 +#: ../libvips/conversion/tilecache.c:401 ../libvips/conversion/embed.c:552 #: ../libvips/conversion/cache.c:102 ../libvips/conversion/sequential.c:305 msgid "Input image" msgstr "" @@ -1058,66 +1058,74 @@ msgstr "" msgid "Top edge of sub in main" msgstr "" -#: ../libvips/conversion/tilecache.c:386 ../libvips/conversion/cache.c:97 +#: ../libvips/conversion/tilecache.c:394 ../libvips/conversion/cache.c:97 msgid "cache an image" msgstr "" -#: ../libvips/conversion/tilecache.c:398 ../libvips/conversion/cache.c:114 +#: ../libvips/conversion/tilecache.c:406 ../libvips/conversion/cache.c:114 #: ../libvips/conversion/sequential.c:317 ../libvips/foreign/tiffsave.c:223 #: ../libvips/foreign/dzsave.c:1386 msgid "Tile height" msgstr "" -#: ../libvips/conversion/tilecache.c:399 ../libvips/conversion/cache.c:115 +#: ../libvips/conversion/tilecache.c:407 ../libvips/conversion/cache.c:115 #: ../libvips/conversion/sequential.c:318 ../libvips/foreign/tiffsave.c:224 #: ../libvips/foreign/dzsave.c:1387 msgid "Tile height in pixels" msgstr "" -#: ../libvips/conversion/tilecache.c:405 -msgid "Threaded" -msgstr "" - -#: ../libvips/conversion/tilecache.c:406 -msgid "Allow threaded access" -msgstr "" - -#: ../libvips/conversion/tilecache.c:412 +#: ../libvips/conversion/tilecache.c:413 msgid "Strategy" msgstr "" -#: ../libvips/conversion/tilecache.c:413 +#: ../libvips/conversion/tilecache.c:414 msgid "Expected access pattern" msgstr "" -#: ../libvips/conversion/tilecache.c:658 +#: ../libvips/conversion/tilecache.c:420 +msgid "Threaded" +msgstr "" + +#: ../libvips/conversion/tilecache.c:421 +msgid "Allow threaded access" +msgstr "" + +#: ../libvips/conversion/tilecache.c:427 +msgid "Persistent" +msgstr "" + +#: ../libvips/conversion/tilecache.c:428 +msgid "Keep cache between evaluations" +msgstr "" + +#: ../libvips/conversion/tilecache.c:677 #, c-format msgid "error reading tile %dx%d: %s" msgstr "" -#: ../libvips/conversion/tilecache.c:747 +#: ../libvips/conversion/tilecache.c:766 msgid "cache an image as a set of tiles" msgstr "" -#: ../libvips/conversion/tilecache.c:751 ../libvips/conversion/cache.c:107 +#: ../libvips/conversion/tilecache.c:770 ../libvips/conversion/cache.c:107 #: ../libvips/foreign/tiffsave.c:216 ../libvips/foreign/dzsave.c:1379 msgid "Tile width" msgstr "" -#: ../libvips/conversion/tilecache.c:752 ../libvips/conversion/cache.c:108 +#: ../libvips/conversion/tilecache.c:771 ../libvips/conversion/cache.c:108 #: ../libvips/foreign/tiffsave.c:217 ../libvips/foreign/dzsave.c:1380 msgid "Tile width in pixels" msgstr "" -#: ../libvips/conversion/tilecache.c:758 ../libvips/conversion/cache.c:121 +#: ../libvips/conversion/tilecache.c:777 ../libvips/conversion/cache.c:121 msgid "Max tiles" msgstr "" -#: ../libvips/conversion/tilecache.c:759 ../libvips/conversion/cache.c:122 +#: ../libvips/conversion/tilecache.c:778 ../libvips/conversion/cache.c:122 msgid "Maximum number of tiles to cache" msgstr "" -#: ../libvips/conversion/tilecache.c:915 +#: ../libvips/conversion/tilecache.c:938 msgid "cache an image as a set of lines" msgstr "" diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index cba3257c..34fb2807 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -33,6 +33,8 @@ * - much more gentle extra sharpening * 13/11/12 * - allow absolute paths in -o (thanks fuho) + * 3/5/13 + * - add optional sharpening mask from file */ #ifdef HAVE_CONFIG_H @@ -51,13 +53,17 @@ static int thumbnail_size = 128; static char *output_format = "tn_%s.jpg"; static char *interpolator = "bilinear"; -static gboolean nosharpen = FALSE; static char *export_profile = NULL; static char *import_profile = NULL; +static char *convolution_mask = NULL; static gboolean delete_profile = FALSE; -static gboolean nodelete_profile = FALSE; static gboolean verbose = FALSE; +/* Deprecated and unused. + */ +static gboolean nosharpen = FALSE; +static gboolean nodelete_profile = FALSE; + static GOptionEntry options[] = { { "size", 's', 0, G_OPTION_ARG_INT, &thumbnail_size, @@ -71,9 +77,10 @@ static GOptionEntry options[] = { G_OPTION_ARG_STRING, &interpolator, N_( "resample with INTERPOLATOR" ), N_( "INTERPOLATOR" ) }, - { "nosharpen", 'n', 0, - G_OPTION_ARG_NONE, &nosharpen, - N_( "don't sharpen thumbnail" ), NULL }, + { "sharpen", 'r', 0, + G_OPTION_ARG_STRING, &convolution_mask, + N_( "sharpen with MASKFILE" ), + N_( "MASKFILE" ) }, { "eprofile", 'e', 0, G_OPTION_ARG_STRING, &export_profile, N_( "export with PROFILE" ), @@ -85,12 +92,15 @@ static GOptionEntry options[] = { { "delete", 'd', 0, G_OPTION_ARG_NONE, &delete_profile, N_( "delete profile from exported image" ), NULL }, - { "nodelete", 'l', G_OPTION_FLAG_HIDDEN, - G_OPTION_ARG_NONE, &nodelete_profile, - N_( "(deprecated, does nothing)" ), NULL }, { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, N_( "verbose output" ), NULL }, + { "nodelete", 'l', G_OPTION_FLAG_HIDDEN, + G_OPTION_ARG_NONE, &nodelete_profile, + N_( "(deprecated, does nothing)" ), NULL }, + { "nosharpen", 'n', G_OPTION_FLAG_HIDDEN, + G_OPTION_ARG_NONE, &nosharpen, + N_( "(deprecated, does nothing)" ), NULL }, { NULL } }; @@ -138,12 +148,17 @@ sharpen_filter( void ) { static INTMASK *mask = NULL; - if( !mask ) { - mask = im_create_imaskv( "sharpen.con", 3, 3, - -1, -1, -1, - -1, 32, -1, - -1, -1, -1 ); - mask->scale = 24; + if( !mask ) { + if( strcmp( convolution_mask, "mild" ) == 0 ) { + mask = im_create_imaskv( "sharpen.con", 3, 3, + -1, -1, -1, + -1, 32, -1, + -1, -1, -1 ); + mask->scale = 24; + } + else + if( !(mask = im_read_imask( convolution_mask )) ) + error_exit( "unable to load sharpen mask" ); } return( mask ); @@ -211,7 +226,9 @@ shrink_factor( IMAGE *in, IMAGE *out, /* If we are upsampling, don't sharpen, since nearest looks dumb * sharpened. */ - if( shrink > 1 && residual <= 1.0 && !nosharpen ) { + if( shrink > 1 && + residual <= 1.0 && + convolution_mask ) { if( verbose ) printf( "sharpening thumbnail\n" );