From 7979f76dcd5d5e2340956f6ec3b9009e64648fc1 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 17 Sep 2012 15:20:47 +0200 Subject: Fix EXIF orientation tag after lossless rotate --- man/feh.pre | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'man') diff --git a/man/feh.pre b/man/feh.pre index e047286..5199151 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -1106,6 +1106,16 @@ away. See .Xr jpegtran 1 for more about lossless JPEG rotation. . +.Em Note: +jpegtran does not update EXIF orientation tags. However, +.Nm +assumes that you use the feature to normalize image orientation and want it to +be displayed this way everywhere. After every rotation, it will unconditionally +set the EXIF orientation to 1 +.Pq Qq 0,0 is top left . +Should you need to reverse this, see +.Xr jpegexiforient 1 . +. .It _ Bq flip . In place editing - vertical flip @@ -1487,7 +1497,9 @@ but without the flickering. .Nm requires the .Cm jpegtran -binary +and +.Cm jpegexiforient +binaries .Pq usually distributed in Qo libjpeg-progs Qc or similar for lossless rotation. . -- cgit v1.2.3 From b4838c78ac9336d2ec3c7e97df6153b6e6553826 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 21 Sep 2012 00:31:33 +0200 Subject: feh.1: Fix spelling --- man/feh.pre | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'man') diff --git a/man/feh.pre b/man/feh.pre index 5199151..fc45a3d 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -31,7 +31,7 @@ $MAN_XINERAMA$, builtin EXIF support $MAN_EXIF$$MAN_DEBUG$ .Sh DESCRIPTION . .Nm -is a mode-based image viewer. It is especially aimed at commandline users who +is a mode-based image viewer. It is especially aimed at command line users who need a fast image viewer without huge GUI dependencies, though it can also be started by .Pq graphical @@ -61,7 +61,7 @@ However, if you compile feh with exif=1, you can also display it directly. .Sh MODES . .Nm -is based on various modes, which are selected at startup by comandline +is based on various modes, which are selected at startup by command line options. . .Pp @@ -158,7 +158,7 @@ multiwindow mode, the window will be closed. . .It Cm --action1 No .. Cm --action9 . -Extra actions which can be set and triggered using the appropiate number key. +Extra actions which can be set and triggered using the appropriate number key. . .It Cm -Z , --auto-zoom . @@ -192,7 +192,7 @@ the caption will be looked for in Don't display images, print image info according to .Ar format instead. See -.Sx FORMAT SPECIFIEDRS . +.Sx FORMAT SPECIFIERS . . .It Cm --cycle-once . @@ -246,7 +246,7 @@ will be saved to .Ar file when .Nm -exits. You can add files to filelists by specifying them on the commandline +exits. You can add files to filelists by specifying them on the command line when also specifying the list. . .Pp @@ -287,7 +287,7 @@ Enables . Note: This option needs to load all images to calculate the dimensions of the .Nm -window, so when using it with many files it will ake a while before a +window, so when using it with many files it will take a while before a .Nm window is visible. Use .Cm --preload @@ -329,7 +329,7 @@ Accepted values: checks (default), white, black. .It Cm -i , --index . Enable Index mode. Index mode is similar to montage mode, and accepts the -same options. It creates an index print of thumbails, printing the image +same options. It creates an index print of thumbnails, printing the image name beneath each thumbnail. Index mode enables certain other options, see .Sx INDEX MODE OPTIONS and @@ -377,7 +377,7 @@ in the name. . .It Cm -l , --list . -Don't display images. Analyse them and display an +Don't display images. Analyze them and display an .Xr ls 1 - No style listing. Useful in scripts to hunt out images of a certain size/resolution/type etc. @@ -662,7 +662,7 @@ without displaying it. . Normally, if an image is smaller than the specified thumbnail size, it will not be enlarged. If this option is set, the image will be scaled up to fit -the thumnail size. Aspect ratio will be maintained unles +the thumbnail size. Aspect ratio will be maintained unless .Cm --ignore-aspect is specified. . @@ -715,7 +715,7 @@ can also be used as a background setter. Unless you pass the .Cm --no-fehbg option, it will store the command line necessary to set the background in .Pa ~/.fehbg , -so to have your background restored everytime you start X, you can add +so to have your background restored every time you start X, you can add .Qq eval $(cat ~/.fehbg) to your X startup script .Pq like Pa ~/.xinitrc . @@ -821,7 +821,7 @@ Number of image pixels . .It \&%P . -Numbor of image pixels +Number of image pixels .Pq kilopixels / megapixels . .It %r -- cgit v1.2.3 From 906ec657cdd958b25a6833f644a57bcf08c3a38b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 13 Oct 2012 16:26:53 +0200 Subject: Add --min-dimension and --max-dimension options (closes #101) --- ChangeLog | 5 +++++ man/feh.pre | 22 ++++++++++++++++++++++ src/filelist.c | 10 +++++++++- src/options.c | 13 +++++++++++-- src/options.h | 2 ++ test/feh.t | 31 ++++++++++++++++++++++++++++--- test/no-loadable-files | 2 ++ 7 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 test/no-loadable-files (limited to 'man') diff --git a/ChangeLog b/ChangeLog index 6cfe1aa..0f2e77a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +git HEAD + + * Add --min-dim and --max-dim options to only process images with certain + dimensions + Thu, 27 Sep 2012 16:48:48 +0200 Daniel Friesel * Fix segfault when doing lossless mirror/rotate and jpegexiforient is diff --git a/man/feh.pre b/man/feh.pre index fc45a3d..8ef5318 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -397,6 +397,15 @@ of zero causes .Nm to try indefinitely. By default, magick support is disabled. . +.It Cm --max-dimension Ar width No x Ar height +. +Only show images with width <= +.Ar width +and height <= +.Ar height . +If you only care about one parameter, set the other to either something large +or -1. +. .It Cm -M , --menu-font Ar font . Use @@ -404,6 +413,14 @@ Use .Pq truetype, with size, like Qq yudit/12 as menu font. . +.It Cm --min-dimension Ar width No x Ar height +. +Only show images with width >= +.Ar width +and height >= +.Ar height . +If you only care about one parameter, set the other to 0. +. .It Cm -m , --montage . Enable montage mode. Montage mode creates a new image consisting of a grid of @@ -1463,6 +1480,11 @@ Same as above . Show some EXIF information, extracted by exifprobe/exifgrep . +.It feh --action 'rm %F' -rl --max-dim 1000x800 +. +Resursively remove all images with dimensions below or equal to 1000x800 pixels +from the current directory. +. .El . . diff --git a/src/filelist.c b/src/filelist.c index 920a5ef..542dbdf 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -281,6 +281,13 @@ gib_list *feh_file_info_preload(gib_list * list) remove_list = gib_list_add_front(remove_list, l); if (opt.verbose) feh_display_status('x'); + } else if (((unsigned int)file->info->width < opt.min_width) + || ((unsigned int)file->info->width > opt.max_width) + || ((unsigned int)file->info->height < opt.min_height) + || ((unsigned int)file->info->height > opt.max_height)) { + remove_list = gib_list_add_front(remove_list, l); + if (opt.verbose) + feh_display_status('s'); } else if (opt.verbose) feh_display_status('.'); } @@ -375,7 +382,8 @@ int feh_cmp_format(void *file1, void *file2) void feh_prepare_filelist(void) { if (opt.list || opt.customlist || (opt.sort > SORT_FILENAME) - || opt.preload) { + || opt.preload || opt.min_width || opt.min_height + || (opt.max_width != UINT_MAX) || (opt.max_height != UINT_MAX)) { /* For these sort options, we have to preload images */ filelist = feh_file_info_preload(filelist); if (!gib_list_length(filelist)) diff --git a/src/options.c b/src/options.c index 5976c10..240b0d6 100644 --- a/src/options.c +++ b/src/options.c @@ -60,6 +60,7 @@ void init_parse_options(int argc, char **argv) opt.menu_font = estrdup(DEFAULT_MENU_FONT); opt.font = NULL; opt.menu_bg = estrdup(PREFIX "/share/feh/images/menubg_default.png"); + opt.max_height = opt.max_width = UINT_MAX; opt.start_list_at = NULL; opt.jump_on_resort = 1; @@ -300,15 +301,18 @@ static void feh_getopt_theme(int argc, char **argv) static void feh_parse_option_array(int argc, char **argv, int finalrun) { + int discard; static char stropts[] = "a:A:b:B:cC:dD:e:E:f:Fg:GhH:iIj:J:kK:lL:mM:nNo:O:pPqrR:sS:tT:uUvVwW:xXy:YzZ" - ".@:^:~:):|:+:"; + ".@:^:~:):|:+:<:>:"; /* (*name, has_arg, *flag, val) See: struct option in getopts.h */ static struct option lopts[] = { {"menu-bg" , 1, 0, ')'}, {"debug" , 0, 0, '+'}, {"scale-down" , 0, 0, '.'}, + {"max-dimension" , 1, 0, '<'}, + {"min-dimension" , 1, 0, '>'}, {"title-font" , 1, 0, '@'}, {"action" , 1, 0, 'A'}, {"image-bg" , 1, 0, 'B'}, @@ -398,7 +402,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) }; int optch = 0, cmdx = 0; - /* Now to pass some optionarinos */ while ((optch = getopt_long(argc, argv, stropts, lopts, &cmdx)) != EOF) { D(("Got option, getopt calls it %d, or %c\n", optch, optch)); switch (optch) { @@ -412,6 +415,12 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case '+': opt.debug = 1; break; + case '<': + XParseGeometry(optarg, &discard, &discard, &opt.max_width, &opt.max_height); + break; + case '>': + XParseGeometry(optarg, &discard, &discard, &opt.min_width, &opt.min_height); + break; case '.': opt.scale_down = 1; break; diff --git a/src/options.h b/src/options.h index a763642..d30c396 100644 --- a/src/options.h +++ b/src/options.h @@ -109,6 +109,8 @@ struct __fehoptions { int zoom_mode; unsigned char adjust_reload; + unsigned int min_width, min_height, max_width, max_height; + unsigned char mode; unsigned char paused; diff --git a/test/feh.t b/test/feh.t index 1d5576b..8f415f3 100644 --- a/test/feh.t +++ b/test/feh.t @@ -2,13 +2,14 @@ use strict; use warnings; use 5.010; -use Test::Command tests => 59; +use Test::Command tests => 71; $ENV{HOME} = 'test'; my $feh = "src/feh"; -my $images = 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm ' - . 'test/fail/gif test/fail/jpg test/fail/png test/fail/pnm'; +my $images_ok = 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm'; +my $images_fail = 'test/fail/gif test/fail/jpg test/fail/png test/fail/pnm'; +my $images = "${images_ok} ${images_fail}"; my $feh_name = $ENV{'PACKAGE'}; @@ -133,3 +134,27 @@ $cmd = Test::Command->new(cmd => $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/default'); $cmd->stderr_like($re_list_action); + +$cmd = Test::Command->new(cmd => "$feh --list --min-dimension 20x20 $images_ok"); + +$cmd->exit_is_num(1); +$cmd->stdout_is_eq(''); +$cmd->stderr_is_file('test/no-loadable-files'); + +$cmd = Test::Command->new(cmd => "$feh --list --max-dimension 10x10 $images_ok"); + +$cmd->exit_is_num(1); +$cmd->stdout_is_eq(''); +$cmd->stderr_is_file('test/no-loadable-files'); + +$cmd = Test::Command->new(cmd => "$feh --list --min-dimension 16x16 $images_ok"); + +$cmd->exit_is_num(0); +$cmd->stdout_is_file('test/list/default'); +$cmd->stderr_is_eq(''); + +$cmd = Test::Command->new(cmd => "$feh --list --max-dimension 16x16 $images_ok"); + +$cmd->exit_is_num(0); +$cmd->stdout_is_file('test/list/default'); +$cmd->stderr_is_eq(''); diff --git a/test/no-loadable-files b/test/no-loadable-files new file mode 100644 index 0000000..bc5871d --- /dev/null +++ b/test/no-loadable-files @@ -0,0 +1,2 @@ +feh: No loadable images specified. +See 'man feh' for detailed usage information -- cgit v1.2.3 From 7c00adf853acc76520d43a12eb63ec151924d5ab Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 23 Oct 2012 17:42:12 +0200 Subject: Do not apply --scale-down to a thumbnail window (#106) --- man/feh.pre | 6 ++++-- src/winwidget.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'man') diff --git a/man/feh.pre b/man/feh.pre index 8ef5318..c60e15a 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -558,8 +558,10 @@ theme. Same as Index mode, but the thumbnails are clickable image launchers. Note that .Cm --fullscreen -does not affect the thumbnail window. It does, however, work for the image -windows launched from thumbnail mode. +and +.Cm --scale-down +do not affect the thumbnail window. They do, however, work for image windows +launched from thumbnail mode. Also supports .Sx MONTAGE MODE OPTIONS . . diff --git a/src/winwidget.c b/src/winwidget.c index 0a9adc8..2f543df 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -402,6 +402,7 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) if (!winwid->full_screen && opt.scale_down && ((winwid->w < winwid->im_w) || (winwid->h < winwid->im_h)) && + (winwid->type != WIN_TYPE_THUMBNAIL) && (winwid->old_zoom == 1.0)) { D(("scaling down image %dx%d\n", winwid->w, winwid->h)); @@ -512,7 +513,8 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) winwid->im_y = (int) (max_h - (winwid->im_h * winwid->zoom)) >> 1; } } - else if (need_center && !winwid->full_screen && opt.scale_down) { + else if (need_center && !winwid->full_screen && opt.scale_down + && (winwid->type != WIN_TYPE_THUMBNAIL)) { winwid->im_x = (int) (winwid->w - (winwid->im_w * winwid->zoom)) >> 1; winwid->im_y = (int) (winwid->h - (winwid->im_h * winwid->zoom)) >> 1; } -- cgit v1.2.3