3 my ($file, $size) = @ARGV;
6 require Image::ExifTool;
7 my $exif = Image::ExifTool->new->ImageInfo($file, {
10 die "exiftool: $exif->{Error}\n" if $exif->{Error};
13 $exif->{ImageSize} ? "$exif->{ImageSize} ($exif->{Megapixels}MP)" : (),
15 $exif->{YCbCrSubSampling} // (),
16 $exif->{Interlace} // (),
17 $exif->{Compression} // $exif->{FileType},
18 $exif->{SVGVersion} // $exif->{PDFVersion} // (),
20 $exif->{ColorType} ? "$exif->{BitDepth}bpp $exif->{ColorType}" : (),
21 sprintf('exif x%d', scalar %{$exif}),
22 $exif->{Thumb} ? "thumb $exif->{ThumbnailLength}B" : (),
24 $exif->{DateCreated} //
25 $exif->{CircaDateCreated} //
26 $exif->{ModifyDate} //
27 $exif->{ZipModifyDate} //
31 $exif->{GPSPosition} // $exif->{Location} // (),
32 $exif->{GPSAltitude} // (),
34 (map "hw $_", join(' ',
35 $exif->{Make} // (), $exif->{Model} // (),
36 $exif->{FOV} ? "(FOV $exif->{FOV})" : (),
38 (map "sw $_", $exif->{Software} // $exif->{Application} // ()),
39 (map "> $_", $exif->{'Description-nl'} // ()),
40 $exif->{Warning} ? "! $exif->{Warning}" : (),
45 my $filesize = (stat $file)[7];
48 open my $bin, '<', $file;
50 my $md5 = Digest::MD5->new->addfile($bin)->b64digest;
51 push @info, "# $md5 ($filesize)";
54 open my $pgm, '-|', convert => (
57 '+distort' => SRT => '0,0 1,.56 0',
58 -thumbnail => $size || '40x12',
59 -colorspace => 'gray',
61 -background => 'black',
67 if (<$pgm> eq "P2\n") {
68 my ($width, $height) = split ' ', <$pgm>;
69 <$pgm>; # ignore depth
70 my @ch = split //, " .:oO@";
72 print $ch[ $_ * @ch >> 8 ] for /\d+/g;
73 print ' ', shift @info if @info;
76 substr $_, 0, 0, ' ' x ($width + 1) for @info;