sharpen param to vipsthumbnail
This commit is contained in:
parent
8956ba536b
commit
f80bf594ce
@ -1,4 +1,5 @@
|
|||||||
12/3/13 started 7.33.0
|
12/3/13 started 7.33.0
|
||||||
|
- vipsthumbnail lets you specify the sharpening mask
|
||||||
|
|
||||||
16/4/13 started 7.32.3
|
16/4/13 started 7.32.3
|
||||||
- rename GETTEXT_PACKAGE as vips7.32 to help Debian (thanks Jay)
|
- rename GETTEXT_PACKAGE as vips7.32 to help Debian (thanks Jay)
|
||||||
|
27
TODO
27
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
|
- look at
|
||||||
|
|
||||||
|
@ -33,15 +33,6 @@ will read image file
|
|||||||
and write a 64 x 64 pixel thumbnail to the file
|
and write a 64 x 64 pixel thumbnail to the file
|
||||||
.B thumbnails/fred.png.
|
.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
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B -s N, --size=N
|
.B -s N, --size=N
|
||||||
@ -77,11 +68,15 @@ to see a list of valid interpolators. The default is
|
|||||||
.B bilinear.
|
.B bilinear.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B -n, --nosharpen
|
.B -r, --sharpen=MASKFILE
|
||||||
By default,
|
Images can look a little soft after shrinking. This option lets you specify a
|
||||||
.B vipsthumbnail(1)
|
sharpening mask. Use "mild" to select a built-in mask which sharpens slightly.
|
||||||
will sharpen thumbnails slightly to make them look more pleasing. This option
|
The built-in mask is:
|
||||||
disables this sharpening.
|
|
||||||
|
3 3 24 0
|
||||||
|
-1 -1 -1
|
||||||
|
-1 32 -1
|
||||||
|
-1 -1 -1
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B -e PROFILE, --eprofile=PROFILE
|
.B -e PROFILE, --eprofile=PROFILE
|
||||||
@ -101,11 +96,9 @@ should be supplied with the
|
|||||||
option.
|
option.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B -l, --nodelete
|
.B -d, --delete
|
||||||
Don't delete the profile from the output image. Since all output images will
|
Delete the output profile from the image. This can save a small amount of
|
||||||
generally have the same profile,
|
space.
|
||||||
.B vipsthumbnail(1)
|
|
||||||
will usually delete it. This option leaves the profile inside the image.
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B -v, --verbose
|
.B -v, --verbose
|
||||||
|
@ -9,7 +9,7 @@ msgstr ""
|
|||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
|
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
|
||||||
"product=glib&keywords=I18N+L10N&component=general\n"
|
"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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -185,7 +185,7 @@ msgstr ""
|
|||||||
#: ../libvips/conversion/extract.c:360 ../libvips/conversion/bandjoin.c:172
|
#: ../libvips/conversion/extract.c:360 ../libvips/conversion/bandjoin.c:172
|
||||||
#: ../libvips/conversion/bandbool.c:212 ../libvips/conversion/copy.c:322
|
#: ../libvips/conversion/bandbool.c:212 ../libvips/conversion/copy.c:322
|
||||||
#: ../libvips/conversion/rot.c:360 ../libvips/conversion/replicate.c:197
|
#: ../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/cache.c:101 ../libvips/conversion/recomb.c:205
|
||||||
#: ../libvips/conversion/sequential.c:304 ../libvips/foreign/foreign.c:1361
|
#: ../libvips/conversion/sequential.c:304 ../libvips/foreign/foreign.c:1361
|
||||||
#: ../libvips/resample/resample.c:90
|
#: ../libvips/resample/resample.c:90
|
||||||
@ -389,7 +389,7 @@ msgstr ""
|
|||||||
#: ../libvips/conversion/flatten.c:378 ../libvips/conversion/extract.c:201
|
#: ../libvips/conversion/flatten.c:378 ../libvips/conversion/extract.c:201
|
||||||
#: ../libvips/conversion/extract.c:361 ../libvips/conversion/copy.c:323
|
#: ../libvips/conversion/extract.c:361 ../libvips/conversion/copy.c:323
|
||||||
#: ../libvips/conversion/rot.c:361 ../libvips/conversion/replicate.c:198
|
#: ../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
|
#: ../libvips/conversion/cache.c:102 ../libvips/conversion/sequential.c:305
|
||||||
msgid "Input image"
|
msgid "Input image"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -1058,66 +1058,74 @@ msgstr ""
|
|||||||
msgid "Top edge of sub in main"
|
msgid "Top edge of sub in main"
|
||||||
msgstr ""
|
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"
|
msgid "cache an image"
|
||||||
msgstr ""
|
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/conversion/sequential.c:317 ../libvips/foreign/tiffsave.c:223
|
||||||
#: ../libvips/foreign/dzsave.c:1386
|
#: ../libvips/foreign/dzsave.c:1386
|
||||||
msgid "Tile height"
|
msgid "Tile height"
|
||||||
msgstr ""
|
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/conversion/sequential.c:318 ../libvips/foreign/tiffsave.c:224
|
||||||
#: ../libvips/foreign/dzsave.c:1387
|
#: ../libvips/foreign/dzsave.c:1387
|
||||||
msgid "Tile height in pixels"
|
msgid "Tile height in pixels"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../libvips/conversion/tilecache.c:405
|
#: ../libvips/conversion/tilecache.c:413
|
||||||
msgid "Threaded"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../libvips/conversion/tilecache.c:406
|
|
||||||
msgid "Allow threaded access"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../libvips/conversion/tilecache.c:412
|
|
||||||
msgid "Strategy"
|
msgid "Strategy"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../libvips/conversion/tilecache.c:413
|
#: ../libvips/conversion/tilecache.c:414
|
||||||
msgid "Expected access pattern"
|
msgid "Expected access pattern"
|
||||||
msgstr ""
|
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
|
#, c-format
|
||||||
msgid "error reading tile %dx%d: %s"
|
msgid "error reading tile %dx%d: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../libvips/conversion/tilecache.c:747
|
#: ../libvips/conversion/tilecache.c:766
|
||||||
msgid "cache an image as a set of tiles"
|
msgid "cache an image as a set of tiles"
|
||||||
msgstr ""
|
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
|
#: ../libvips/foreign/tiffsave.c:216 ../libvips/foreign/dzsave.c:1379
|
||||||
msgid "Tile width"
|
msgid "Tile width"
|
||||||
msgstr ""
|
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
|
#: ../libvips/foreign/tiffsave.c:217 ../libvips/foreign/dzsave.c:1380
|
||||||
msgid "Tile width in pixels"
|
msgid "Tile width in pixels"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../libvips/conversion/tilecache.c:758 ../libvips/conversion/cache.c:121
|
#: ../libvips/conversion/tilecache.c:777 ../libvips/conversion/cache.c:121
|
||||||
msgid "Max tiles"
|
msgid "Max tiles"
|
||||||
msgstr ""
|
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"
|
msgid "Maximum number of tiles to cache"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../libvips/conversion/tilecache.c:915
|
#: ../libvips/conversion/tilecache.c:938
|
||||||
msgid "cache an image as a set of lines"
|
msgid "cache an image as a set of lines"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
* - much more gentle extra sharpening
|
* - much more gentle extra sharpening
|
||||||
* 13/11/12
|
* 13/11/12
|
||||||
* - allow absolute paths in -o (thanks fuho)
|
* - allow absolute paths in -o (thanks fuho)
|
||||||
|
* 3/5/13
|
||||||
|
* - add optional sharpening mask from file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -51,13 +53,17 @@
|
|||||||
static int thumbnail_size = 128;
|
static int thumbnail_size = 128;
|
||||||
static char *output_format = "tn_%s.jpg";
|
static char *output_format = "tn_%s.jpg";
|
||||||
static char *interpolator = "bilinear";
|
static char *interpolator = "bilinear";
|
||||||
static gboolean nosharpen = FALSE;
|
|
||||||
static char *export_profile = NULL;
|
static char *export_profile = NULL;
|
||||||
static char *import_profile = NULL;
|
static char *import_profile = NULL;
|
||||||
|
static char *convolution_mask = NULL;
|
||||||
static gboolean delete_profile = FALSE;
|
static gboolean delete_profile = FALSE;
|
||||||
static gboolean nodelete_profile = FALSE;
|
|
||||||
static gboolean verbose = FALSE;
|
static gboolean verbose = FALSE;
|
||||||
|
|
||||||
|
/* Deprecated and unused.
|
||||||
|
*/
|
||||||
|
static gboolean nosharpen = FALSE;
|
||||||
|
static gboolean nodelete_profile = FALSE;
|
||||||
|
|
||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = {
|
||||||
{ "size", 's', 0,
|
{ "size", 's', 0,
|
||||||
G_OPTION_ARG_INT, &thumbnail_size,
|
G_OPTION_ARG_INT, &thumbnail_size,
|
||||||
@ -71,9 +77,10 @@ static GOptionEntry options[] = {
|
|||||||
G_OPTION_ARG_STRING, &interpolator,
|
G_OPTION_ARG_STRING, &interpolator,
|
||||||
N_( "resample with INTERPOLATOR" ),
|
N_( "resample with INTERPOLATOR" ),
|
||||||
N_( "INTERPOLATOR" ) },
|
N_( "INTERPOLATOR" ) },
|
||||||
{ "nosharpen", 'n', 0,
|
{ "sharpen", 'r', 0,
|
||||||
G_OPTION_ARG_NONE, &nosharpen,
|
G_OPTION_ARG_STRING, &convolution_mask,
|
||||||
N_( "don't sharpen thumbnail" ), NULL },
|
N_( "sharpen with MASKFILE" ),
|
||||||
|
N_( "MASKFILE" ) },
|
||||||
{ "eprofile", 'e', 0,
|
{ "eprofile", 'e', 0,
|
||||||
G_OPTION_ARG_STRING, &export_profile,
|
G_OPTION_ARG_STRING, &export_profile,
|
||||||
N_( "export with PROFILE" ),
|
N_( "export with PROFILE" ),
|
||||||
@ -85,12 +92,15 @@ static GOptionEntry options[] = {
|
|||||||
{ "delete", 'd', 0,
|
{ "delete", 'd', 0,
|
||||||
G_OPTION_ARG_NONE, &delete_profile,
|
G_OPTION_ARG_NONE, &delete_profile,
|
||||||
N_( "delete profile from exported image" ), NULL },
|
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,
|
{ "verbose", 'v', 0,
|
||||||
G_OPTION_ARG_NONE, &verbose,
|
G_OPTION_ARG_NONE, &verbose,
|
||||||
N_( "verbose output" ), NULL },
|
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 }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -138,12 +148,17 @@ sharpen_filter( void )
|
|||||||
{
|
{
|
||||||
static INTMASK *mask = NULL;
|
static INTMASK *mask = NULL;
|
||||||
|
|
||||||
if( !mask ) {
|
if( !mask ) {
|
||||||
mask = im_create_imaskv( "sharpen.con", 3, 3,
|
if( strcmp( convolution_mask, "mild" ) == 0 ) {
|
||||||
-1, -1, -1,
|
mask = im_create_imaskv( "sharpen.con", 3, 3,
|
||||||
-1, 32, -1,
|
-1, -1, -1,
|
||||||
-1, -1, -1 );
|
-1, 32, -1,
|
||||||
mask->scale = 24;
|
-1, -1, -1 );
|
||||||
|
mask->scale = 24;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( !(mask = im_read_imask( convolution_mask )) )
|
||||||
|
error_exit( "unable to load sharpen mask" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( mask );
|
return( mask );
|
||||||
@ -211,7 +226,9 @@ shrink_factor( IMAGE *in, IMAGE *out,
|
|||||||
/* If we are upsampling, don't sharpen, since nearest looks dumb
|
/* If we are upsampling, don't sharpen, since nearest looks dumb
|
||||||
* sharpened.
|
* sharpened.
|
||||||
*/
|
*/
|
||||||
if( shrink > 1 && residual <= 1.0 && !nosharpen ) {
|
if( shrink > 1 &&
|
||||||
|
residual <= 1.0 &&
|
||||||
|
convolution_mask ) {
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( "sharpening thumbnail\n" );
|
printf( "sharpening thumbnail\n" );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user