3 my ($file, $size) = @ARGV;
6 require Image::ExifTool;
7 my $exif = Image::ExifTool->new->ImageInfo($file, {
9 DateFormat => '%Y-%m-%d %H:%M:%S',
10 Exclude => 'System:*',
12 die "exiftool: $exif->{Error}\n" if $exif->{Error};
15 $exif->{ImageSize} ? "$exif->{ImageSize} ($exif->{Megapixels}MP)" : (),
17 $exif->{YCbCrSubSampling} // (),
18 $exif->{Interlace} // (),
19 $exif->{Compression} // $exif->{FileType},
20 $exif->{SVGVersion} // $exif->{PDFVersion} // (),
22 $exif->{ColorType} ? "$exif->{BitDepth}bpp $exif->{ColorType}" : (),
23 sprintf('exif (%d)', scalar %{$exif}),
24 $exif->{Thumb} ? "thumb $exif->{ThumbnailLength}B" : (),
26 $exif->{DateTimeOriginal} //
27 $exif->{DateCreated} //
28 $exif->{CircaDateCreated} //
29 $exif->{ModifyDate} //
30 $exif->{ZipModifyDate} //
34 $exif->{GPSPosition} // $exif->{Location} // (),
35 $exif->{GPSAltitude} // (),
37 (map "hw $_", join(' ',
38 $exif->{Make} // (), $exif->{Model} // (),
39 $exif->{FOV} ? "(FOV $exif->{FOV})" : (),
41 (map "sw $_", $exif->{Software} // $exif->{Application} // ()),
42 (map "> $_", $exif->{'Description-nl'} // ()),
43 $exif->{Warning} ? "! $exif->{Warning}" : (),
48 my $filesize = (stat $file)[7];
51 open my $bin, '<', $file;
53 my $md5 = Digest::MD5->new->addfile($bin)->b64digest;
54 push @info, "# $md5 ($filesize)";
57 open my $pgm, '-|', convert => (
60 '+distort' => SRT => '0,0 1,.56 0',
61 -thumbnail => $size || '40x12',
62 -colorspace => 'gray',
65 -channel => 'A', -threshold => '50%',
66 -background => 'black',
72 if (<$pgm> eq "P2\n") {
73 my ($width, $height) = split ' ', <$pgm>;
74 <$pgm>; # ignore depth
75 my @ch = split //, " .:oO@";
77 print !$_ ? '/' : $ch[ $_ * @ch >> 8 ] for /\d+/g;
78 print ' ', shift @info if @info;
81 substr $_, 0, 0, ' ' x ($width + 1) for @info;