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',
11 die "exiftool: $exif->{Error}\n" if $exif->{Error};
14 $exif->{ImageSize} ? "$exif->{ImageSize} ($exif->{Megapixels}MP)" : (),
16 $exif->{YCbCrSubSampling} // (),
17 $exif->{Interlace} // (),
18 $exif->{Compression} // $exif->{FileType},
19 $exif->{SVGVersion} // $exif->{PDFVersion} // (),
21 $exif->{ColorType} ? "$exif->{BitDepth}bpp $exif->{ColorType}" : (),
22 sprintf('exif x%d', scalar %{$exif}),
23 $exif->{Thumb} ? "thumb $exif->{ThumbnailLength}B" : (),
25 $exif->{DateTimeOriginal} //
26 $exif->{DateCreated} //
27 $exif->{CircaDateCreated} //
28 $exif->{ModifyDate} //
29 $exif->{ZipModifyDate} //
33 $exif->{GPSPosition} // $exif->{Location} // (),
34 $exif->{GPSAltitude} // (),
36 (map "hw $_", join(' ',
37 $exif->{Make} // (), $exif->{Model} // (),
38 $exif->{FOV} ? "(FOV $exif->{FOV})" : (),
40 (map "sw $_", $exif->{Software} // $exif->{Application} // ()),
41 (map "> $_", $exif->{'Description-nl'} // ()),
42 $exif->{Warning} ? "! $exif->{Warning}" : (),
47 my $filesize = (stat $file)[7];
50 open my $bin, '<', $file;
52 my $md5 = Digest::MD5->new->addfile($bin)->b64digest;
53 push @info, "# $md5 ($filesize)";
56 open my $pgm, '-|', convert => (
59 '+distort' => SRT => '0,0 1,.56 0',
60 -thumbnail => $size || '40x12',
61 -colorspace => 'gray',
63 -background => 'black',
69 if (<$pgm> eq "P2\n") {
70 my ($width, $height) = split ' ', <$pgm>;
71 <$pgm>; # ignore depth
72 my @ch = split //, " .:oO@";
74 print $ch[ $_ * @ch >> 8 ] for /\d+/g;
75 print ' ', shift @info if @info;
78 substr $_, 0, 0, ' ' x ($width + 1) for @info;