-
Notifications
You must be signed in to change notification settings - Fork 1
/
verso.pl
executable file
·802 lines (677 loc) · 22.5 KB
/
verso.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
#!/usr/bin/perl
# Verso - editor for embedded image metadata
#
# Copyright 2013-2023 Martin Hoppenheit <martin@hoppenheit.info>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use 5.010;
use utf8;
use Image::ExifTool;
use Gtk3 -init;
use Config::General;
use Getopt::Long;
use Pod::Usage;
use Encode qw(decode encode);
use File::Basename;
use File::Temp qw(tempfile);
use File::Copy;
use List::Util qw(min any);
my $app_name = 'Verso';
my $app_version = '1.2.1';
my $app_description = 'editor for embedded image metadata';
my $app_copyright = 'Copyright 2013-2023 Martin Hoppenheit';
my $app_website = 'https://martin.hoppenheit.info/code/verso/';
my @files; # full paths of all files to be displayed
my $index; # index of current file in @files
my $exiftool = Image::ExifTool->new();
## Command line options. ##
my $opt_help = 0; # Help message.
my $opt_config = undef; # Custom config file path.
my @opt_fields = (); # Additional metadata fields.
my $opt_readonly = 0; # Readonly.
Getopt::Long::Configure('bundling');
GetOptions(
'help|h' => \$opt_help,
'config|c=s' => \$opt_config,
'field|f=s' => \@opt_fields,
'readonly|r' => \$opt_readonly,
);
pod2usage(1) if $opt_help;
## Load config. ##
my $conf;
# Custom config file from --config command line option.
if (defined $opt_config and -e $opt_config) {
$conf = Config::General->new(
-ConfigFile => $opt_config,
-AutoTrue => 1,
);
}
# User specifig config file.
elsif (-e "$ENV{HOME}/.verso.conf") {
$conf = Config::General->new(
-ConfigFile => "$ENV{HOME}/.verso.conf",
-AutoTrue => 1,
);
}
# System wide config file.
elsif (-e '/etc/verso.conf') {
$conf = Config::General->new(
-ConfigFile => '/etc/verso.conf',
-AutoTrue => 1,
);
}
# No config file, default values.
else {
$conf = Config::General->new(
-ConfigHash => {},
-AutoTrue => 1,
);
}
my %config = $conf->getall();
my @default_fields = (
# A minimum field definition consists of a tag and a label; default values
# are provided below for tooltip (the empty string) and editable (true).
{
tag => 'XMP-dc:Description',
label => 'Description',
tooltip => 'The content and context of the image.',
editable => 'yes',
},
{
tag => 'XMP-dc:Date',
label => 'Date',
tooltip => 'The date and time the image was taken.',
editable => 'yes',
},
{
tag => 'XMP-dc:Creator',
label => 'Creator',
tooltip => 'The photographer who created the image.',
editable => 'yes',
},
{
tag => 'XMP-dc:Rights',
label => 'Rights',
tooltip => 'The intellectual property rights or licenses.',
editable => 'yes',
},
);
$config{field} //= \@default_fields;
$config{windowwidth} //= 500;
$config{windowheight} //= 500;
$config{maximize} //= 0;
$config{viewer} //= 'xdg-open';
$config{extension} //= ['*'];
## Build GUI: basic stuff. ##
my $window = Gtk3::Window->new('toplevel');
$window->set_title('Verso');
$window->set_default_size($config{windowwidth}, $config{windowheight});
$window->maximize() if $config{maximize};
$window->signal_connect('delete-event' => sub { Gtk3::main_quit });
my $grid1 = Gtk3::Grid->new();
$window->add($grid1);
## Build GUI: menubar. Also keyboard shortcuts. ##
# Hex representations of key values (like 0x006f for the 'o' key) can be found
# in /usr/include/X11/keysymdef.h!
my $menubar = Gtk3::MenuBar->new();
$grid1->attach($menubar, 1, 1, 1, 1);
my $accelerators = Gtk3::AccelGroup->new();
$window->add_accel_group($accelerators);
my $menu_item_file = Gtk3::MenuItem->new_with_mnemonic('_File');
$menubar->append($menu_item_file);
my $menu_file = Gtk3::Menu->new();
$menu_item_file->set_submenu($menu_file);
my $menu_item_file_open = Gtk3::MenuItem->new_with_mnemonic('_Open');
$menu_file->append($menu_item_file_open);
$menu_item_file_open->signal_connect(
'activate' => \&on_menu_file_open_activate
);
$menu_item_file_open->add_accelerator(
'activate',
$accelerators,
0x006f, # 'GDK_o' did not work
'GDK_CONTROL_MASK',
'GTK_ACCEL_VISIBLE'
);
my $menu_item_file_save = Gtk3::MenuItem->new_with_mnemonic('_Save changes');
$menu_file->append($menu_item_file_save);
$menu_item_file_save->signal_connect(
'activate' => \&on_menu_file_save_activate
);
$menu_item_file_save->add_accelerator(
'activate',
$accelerators,
0x0073, # 'GDK_s' did not work
'GDK_CONTROL_MASK',
'GTK_ACCEL_VISIBLE'
);
my $menu_item_file_undo
= Gtk3::MenuItem->new_with_mnemonic('_Undo changes');
$menu_file->append($menu_item_file_undo);
$menu_item_file_undo->signal_connect(
'activate' => \&on_menu_file_undo_activate
);
$menu_item_file_undo->add_accelerator(
'activate',
$accelerators,
0x007a, # 'GDK_z' did not work
'GDK_CONTROL_MASK',
'GTK_ACCEL_VISIBLE'
);
my $menu_item_file_view_external
= Gtk3::MenuItem->new_with_mnemonic('View in _external viewer');
$menu_file->append($menu_item_file_view_external);
$menu_item_file_view_external->signal_connect(
'activate' => \&on_menu_file_view_external_activate
);
$menu_item_file_view_external->add_accelerator(
'activate',
$accelerators,
0x0065, # 'GDK_e' did not work
'GDK_CONTROL_MASK',
'GTK_ACCEL_VISIBLE'
);
my $separator = Gtk3::SeparatorMenuItem->new();
$menu_file->append($separator);
my $menu_item_file_first = Gtk3::MenuItem->new_with_mnemonic(
'Go to _first file'
);
$menu_file->append($menu_item_file_first);
$menu_item_file_first->signal_connect(
'activate' => \&on_menu_file_first_activate
);
$menu_item_file_first->add_accelerator(
'activate',
$accelerators,
0x0066, # 'GDK_f' did not work
'GDK_CONTROL_MASK',
'GTK_ACCEL_VISIBLE'
);
my $menu_item_file_previous = Gtk3::MenuItem->new_with_mnemonic(
'Go to _previous file'
);
$menu_file->append($menu_item_file_previous);
$menu_item_file_previous->signal_connect(
'activate' => \&on_menu_file_previous_activate
);
$menu_item_file_previous->add_accelerator(
'activate',
$accelerators,
0x0070, # 'GDK_p' did not work
'GDK_CONTROL_MASK',
'GTK_ACCEL_VISIBLE'
);
my $menu_item_file_next = Gtk3::MenuItem->new_with_mnemonic(
'Go to _next file'
);
$menu_file->append($menu_item_file_next);
$menu_item_file_next->signal_connect(
'activate' => \&on_menu_file_next_activate
);
$menu_item_file_next->add_accelerator(
'activate',
$accelerators,
0x006e, # 'GDK_n' did not work
'GDK_CONTROL_MASK',
'GTK_ACCEL_VISIBLE'
);
my $menu_item_file_last = Gtk3::MenuItem->new_with_mnemonic(
'Go to _last file'
);
$menu_file->append($menu_item_file_last);
$menu_item_file_last->signal_connect(
'activate' => \&on_menu_file_last_activate
);
$menu_item_file_last->add_accelerator(
'activate',
$accelerators,
0x006c, # 'GDK_l' did not work
'GDK_CONTROL_MASK',
'GTK_ACCEL_VISIBLE'
);
my $menu_item_view = Gtk3::MenuItem->new_with_mnemonic('_View');
$menubar->append($menu_item_view);
my $menu_view = Gtk3::Menu->new();
$menu_item_view->set_submenu($menu_view);
my $menu_item_view_fullscreen
= Gtk3::MenuItem->new_with_mnemonic('Toggle _Fullscreen');
$menu_view->append($menu_item_view_fullscreen);
$menu_item_view_fullscreen->signal_connect(
'activate' => \&on_menu_view_fullscreen_activate
);
$menu_item_view_fullscreen->add_accelerator(
'activate',
$accelerators,
0xffc8, # 'GDK_F11' did not work
'GDK_CONTROL_MASK', # TODO How can we use only F11, without Ctrl?
'GTK_ACCEL_VISIBLE'
);
my $menu_item_help = Gtk3::MenuItem->new_with_mnemonic('_Help');
$menubar->append($menu_item_help);
my $menu_help = Gtk3::Menu->new();
$menu_item_help->set_submenu($menu_help);
my $menu_item_help_about = Gtk3::MenuItem->new_with_mnemonic('_About');
$menu_help->append($menu_item_help_about);
$menu_item_help_about->signal_connect(
'activate' => \&on_menu_help_about_activate
);
## Build GUI: workspace pt. 1 (general layout, image display). ##
my $paned = Gtk3::Paned->new('GTK_ORIENTATION_VERTICAL');
$paned->set_margin_top(5);
$paned->set_margin_bottom(5);
$paned->set_margin_left(5);
$paned->set_margin_right(5);
$paned->set_hexpand(1);
$paned->set_vexpand(1);
$grid1->attach($paned, 1, 2, 1, 1);
my $scrolled = Gtk3::ScrolledWindow->new();
$scrolled->set_hexpand(1);
$scrolled->set_vexpand(1);
$scrolled->set_margin_bottom(10);
$paned->pack1($scrolled, 1, 1);
my $image = Gtk3::Image->new();
$scrolled->add_with_viewport($image);
my $grid2 = Gtk3::Grid->new();
$grid2->set_margin_top(10);
$grid2->set_row_spacing(5);
$grid2->set_column_spacing(5);
$paned->pack2($grid2, 0, 0);
## Build GUI: workspace pt. 2 (metadata entry fields). ##
# Every metadata field we want to be able to edit needs an entry in the array
# @fields. Every entry consists of a label for the text entry field (label),
# the metadata field's full tag name (tag), the metadata field's short tag
# name (key, the part after the tag's last (or only?) colon), a tooltip
# describing the metadata field (tooltip), a boolean value whether the text
# entry will be editable (editable) and a place for the entry widget (widget,
# always initialized undef). The reason we need both tag and key is that
# apparently ExifTool needs either of these sometimes... For the most part,
# the array @fields is populated from the array referenced by $config{field},
# but the entries key and widget have to be added since they are not contained
# in the config. Default values are provided where sensible, so the minimum
# config entry for a field definition consists of just tag and label.
# Allow a one-field-only config.
my @fields
= ref $config{field} eq 'ARRAY'
? @{$config{field}}
: ($config{field})
;
# Add fields from --field command line option.
push @fields, map { { tag => $_, label => $_} } @opt_fields;
for my $f (@fields) {
my @tag_parts = split /:/, $f->{tag};
$f->{key} = $tag_parts[-1];
$f->{widget} = undef;
if (!exists $f->{tooltip}) {
$f->{tooltip} = '';
}
if (!exists $f->{editable}) {
$f->{editable} = 1;
}
if ($opt_readonly) {
$f->{editable} = 0;
}
}
for my $i (0..$#fields) {
my $label = Gtk3::Label->new($fields[$i]{'label'});
$label->set_alignment(0, 0.5);
$label->set_tooltip_text($fields[$i]{'tooltip'});
$grid2->attach($label, 1, $i+1, 1, 1);
my $entry = Gtk3::Entry->new();
$entry->set_hexpand(1);
$entry->set_editable($fields[$i]{'editable'});
$entry->set_tooltip_text($fields[$i]{'tooltip'});
$grid2->attach($entry, 2, $i+1, 4, 1);
$fields[$i]{'widget'} = $entry;
}
## Build GUI: workspace pt. 3 (buttons). ##
my $button_line_offset = 1 + scalar @fields;
my $file_counter_label = Gtk3::Label->new('0/0');
$grid2->attach($file_counter_label, 1, $button_line_offset, 1, 1);
my $save_button = Gtk3::Button->new('Save');
$save_button->signal_connect('clicked' => \&on_save_button_clicked);
$grid2->attach($save_button, 2, $button_line_offset, 1, 1);
my $undo_button = Gtk3::Button->new('Undo');
$undo_button->signal_connect('clicked' => \&on_undo_button_clicked);
$grid2->attach($undo_button, 3, $button_line_offset, 1, 1);
my $previous_button = Gtk3::Button->new('Previous');
$previous_button->signal_connect('clicked' => \&on_previous_button_clicked);
$grid2->attach($previous_button, 4, $button_line_offset, 1, 1);
my $next_button = Gtk3::Button->new('Next');
$next_button->signal_connect('clicked' => \&on_next_button_clicked);
$grid2->attach($next_button, 5, $button_line_offset, 1, 1);
$window->show_all();
if (@ARGV) {
init_files(map { decode 'UTF-8', $_ } @ARGV) and load_current_file();
}
Gtk3::main();
## Menu callback routines. ##
sub on_menu_file_open_activate {
my $dialog = Gtk3::FileChooserDialog->new(
'Open file',
$window,
'GTK_FILE_CHOOSER_ACTION_OPEN',
Gtk3::STOCK_CANCEL, 'GTK_RESPONSE_CANCEL',
Gtk3::STOCK_OPEN, 'GTK_RESPONSE_ACCEPT'
);
$dialog->set_select_multiple(1);
if ($dialog->run() eq 'accept') {
init_files(@{$dialog->get_filenames()}) and load_current_file();
}
$dialog->destroy();
return;
}
sub on_menu_file_save_activate {
on_save_button_clicked();
return;
}
sub on_menu_file_undo_activate {
on_undo_button_clicked();
return;
}
sub on_menu_file_view_external_activate {
system "$config{viewer} $files[$index]";
return;
}
sub on_menu_file_first_activate {
if (@files) {
$index = 0;
load_current_file();
}
return;
}
sub on_menu_file_previous_activate {
on_previous_button_clicked();
return;
}
sub on_menu_file_next_activate {
on_next_button_clicked();
return;
}
sub on_menu_file_last_activate {
if (@files) {
$index = $#files;
load_current_file();
}
return;
}
sub on_menu_view_fullscreen_activate {
state $fullscreen = 0;
$fullscreen ? $window->unfullscreen() : $window->fullscreen();
$fullscreen = !$fullscreen;
return;
}
sub on_menu_help_about_activate {
my $dialog = Gtk3::AboutDialog->new();
$dialog->set_transient_for($window);
$dialog->set_program_name($app_name);
$dialog->set_version($app_version);
$dialog->set_copyright($app_copyright);
$dialog->set_comments($app_description);
$dialog->set_license_type('GTK_LICENSE_GPL_3_0');
$dialog->set_website($app_website);
$dialog->run();
$dialog->destroy();
return;
}
## Button callback routines. ##
sub on_save_button_clicked {
write_current_metadata();
return;
}
sub on_undo_button_clicked {
load_current_metadata();
return;
}
sub on_next_button_clicked {
$index++;
if (scalar @files > $index) {
load_current_file();
}
else {
$index--;
}
return;
}
sub on_previous_button_clicked {
$index--;
if ($index >= 0) {
load_current_file();
}
else {
$index++;
}
return;
}
## Other subroutines. ##
sub init_files {
my @paths = map { normalize_file_path($_) } @_;
@files = ();
$index = 0;
if (scalar @paths == 1 and -e -f -r $paths[0]) {
my (undef, $directory, undef) = fileparse($paths[0]);
init_files($directory);
my $i = first_index($paths[0], @files);
$index = $i != -1 ? $i : 0;
}
else {
for my $path (@paths) {
if (!(-e -r $path)) {
create_error("Could not open '$path'");
next;
}
if (-f $path) {
push @files, $path;
}
if (-d $path) {
push @files,
sort
map { normalize_file_path(decode 'UTF-8', $_) }
grep { -f }
glob "'$path'*";
}
}
}
@files = grep { allowed_extension($_) } @files;
# True if there are @files, else false.
return scalar @files;
}
sub allowed_extension {
my $file = shift;
my (undef, undef, $suffix) = fileparse($file, qr/[^.]*$/);
state @extensions
= ref $config{extension} eq 'ARRAY'
? @{$config{extension}}
: ($config{extension})
;
return any { $_ eq $suffix || $_ eq '*' } @extensions;
}
sub first_index {
my ($string, @strings) = @_;
for my $i (0..$#strings) {
return $i if $string eq $strings[$i];
}
return -1;
}
sub normalize_file_path {
my $path = shift;
# Prepend './' to simple file names without full path, otherwise the
# first_index function won't work correctly with globbed files.
$path =~ s{^(?!(/|\./|\.\./|\.$))}{./};
# Make sure a directory path ends with '/', otherwise the fileparse
# function won't work correctly.
$path =~ s{/?$}{/} if -d $path;
return $path;
}
sub load_current_file {
load_current_image();
load_current_metadata();
my ($file, $dir, undef) = fileparse($files[$index]);
$window->set_title("$file ($dir) - Verso");
$file_counter_label->set_text($index + 1 . '/' . scalar @files);
return;
}
sub load_current_image {
eval {
my $w = $scrolled->get_allocation()->{width};
my $h = $scrolled->get_allocation()->{height};
my $pixbuf = Gtk3::Gdk::Pixbuf->new_from_file($files[$index]);
my $pixbuf_rotated = $pixbuf->apply_embedded_orientation();
my $pixbuf_rotated_scaled = scale_pixbuf($pixbuf_rotated, $w, $h);
$image->set_from_pixbuf($pixbuf_rotated_scaled);
};
if ($@) {
if (is_unsupported_format_error($@)) {
$image->set_from_icon_name('image-missing', 'GTK_ICON_SIZE_DIALOG');
}
else {
die $@;
}
}
return;
}
sub scale_pixbuf {
my ($pixbuf, $max_w, $max_h) = @_;
my $pixb_w = $pixbuf->get_width();
my $pixb_h = $pixbuf->get_height();
if (($pixb_w > $max_w) || ($pixb_h > $max_h)) {
my $sc_factor_w = $max_w / $pixb_w;
my $sc_factor_h = $max_h / $pixb_h;
# Choose the smallest scaling factor, so the longest side will fit.
my $sc_factor = min $sc_factor_w, $sc_factor_h;
my $sc_w = int($pixb_w * $sc_factor);
my $sc_h = int($pixb_h * $sc_factor);
my $scaled = $pixbuf->scale_simple($sc_w, $sc_h, 'GDK_INTERP_HYPER');
return $scaled;
}
return $pixbuf;
}
sub is_unsupported_format_error {
my $err = shift;
return Glib::Error::matches($err, 'Gtk3::Gdk::PixbufError', 'unknown-type');
}
sub load_current_metadata {
my @tags = map { $_->{'tag'} } @fields;
my $info = $exiftool->ImageInfo($files[$index], \@tags);
for my $field (@fields) {
my $entry_widget = $field->{'widget'};
my $metadata_key = $field->{'key'};
if (defined $info->{$metadata_key}) {
$entry_widget->set_text(decode 'UTF-8', $info->{$metadata_key});
}
else {
$entry_widget->set_text('');
}
}
$fields[0]{'widget'}->grab_focus();
return;
}
sub write_current_metadata {
for my $field (@fields) {
my $entry_widget = $field->{'widget'};
my $new_value = $entry_widget->get_text();
my $metadata_tag = $field->{'tag'};
$exiftool->SetNewValue($metadata_tag, $new_value, Replace => 1);
}
my $tmpfile = File::Temp->new(SUFFIX => '-verso')->filename();
my $success = $exiftool->WriteInfo($files[$index], $tmpfile);
if ($success) {
copy($tmpfile, $files[$index]);
}
else {
my $e = $exiftool->GetValue('Error');
create_error("Error writing metadata, no changes were made. $e");
}
unlink $tmpfile;
return;
}
sub create_error {
my $msg = shift;
my $dialog = Gtk3::MessageDialog->new(
$window,
'GTK_DIALOG_DESTROY_WITH_PARENT',
'GTK_MESSAGE_ERROR',
'GTK_BUTTONS_CLOSE',
$msg
);
$dialog->run();
$dialog->destroy();
say(encode 'UTF-8', $msg);
return;
}
__END__
=head1 NAME
verso - editor for embedded image metadata
=head1 SYNOPSIS
B<verso> [options] [file|directory ...]
=head1 DESCRIPTION
Verso is an editor for metadata embedded in image files. Metadata can be used
to describe, amongst others, the image's content and the depicted persons, to
provide the date of its creation or to state license information. It can also
contain technical data like shutter speed and focal length.
Verso's default configuration makes it an editor for XMP metadata embedded in
JPEG files, particularly for the Dublin Core metadata elements Description,
Date, Creator and Rights. But since metadata editing is based on ExifTool and
Verso is highly customizable you may adjust the metadata fields that can be
displayed and edited, as long as ExifTool can handle them. So Verso can easily
be adapted to edit for example IPTC or EXIF instead of (or in addition to) XMP
metadata. Metadata fields can be added in the configuration file or on the fly
via command line options. When configured properly, Verso can be used to edit
metadata of non-image files like MP4 videos or PDF documents as well; it
displays just a dummy icon for such files though.
=head1 OPTIONS
=over 4
=item B<-h>, B<--help>
Print a short help message.
=item B<-c> FILE, B<--config> FILE
Use custom configuration file FILE instead of the default path.
=item B<-f> TAG, B<--field> TAG
Add a metadata field specified by the ExifTool tag TAG to the GUI. Example:
$ verso -f DateTimeOriginal -f ImageWidth
=item B<-r>, B<--readonly>
Readonly mode. Make all metadata fields readonly regardless of settings in the
configuration file.
=back
=head1 CONFIGURATION
The default configuration file F</etc/verso.conf> contains all configurable
options together with their default values and some descriptive comments.
=head1 FILES
F</etc/verso.conf>
System wide configuration file.
F<~/.verso.conf>
User specific configuration file.
A user specific configuration file takes precedence over a system wide
configuration file.
=head1 SEE ALSO
exiftool(1p)
=head1 WHAT ABOUT THE NAME?
Recto and verso are the "front" and "back" sides of a leaf of paper. The
metadata that can be edited with Verso is the same one might have written on
the back (aka verso) side of a photo, back in the olden days of non-digital
photography.
=head1 AUTHOR
Martin Hoppenheit L<https://martin.hoppenheit.info/code/verso/>
=head1 COPYRIGHT
Copyright 2013-2023 Martin Hoppenheit <martin@hoppenheit.info>
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program. If not, see L<http://www.gnu.org/licenses/>.