3 my ($file, $size) = @ARGV;
6 require Image::ExifTool;
7 my $exif = Image::ExifTool->new->ImageInfo($file);
8 die "exiftool: $exif->{Error}\n" if $exif->{Error};
11 $exif->{ImageSize} ? "$exif->{ImageSize} ($exif->{Megapixels}MP)" : (),
13 $exif->{YCbCrSubSampling} // (),
14 $exif->{Interlace} // (),
15 $exif->{Compression} // $exif->{FileType},
16 $exif->{SVGVersion} // $exif->{PDFVersion} // (),
18 $exif->{ColorType} ? "$exif->{BitDepth}bpp $exif->{ColorType}" : (),
19 sprintf('exif x%d', scalar %{$exif}),
20 $exif->{Thumb} ? "thumb $exif->{ThumbnailLength}B" : (),
22 $exif->{DateCreated} //
23 $exif->{CircaDateCreated} //
24 $exif->{ModifyDate} //
25 $exif->{ZipModifyDate} //
28 $exif->{GPSPosition} ? $exif->{GPSPosition} =~ s/ deg/./gr :
29 $exif->{Location} ? $exif->{Location} : (),
30 $exif->{GPSAltitude} ? $exif->{GPSAltitude} : (),
31 (map "hw $_", join(' ',
32 $exif->{Make} // (), $exif->{Model} // (),
33 $exif->{FOV} ? "(FOV $exif->{FOV})" : (),
35 (map "sw $_", $exif->{Software} // $exif->{Application} // ()),
36 (map "> $_", $exif->{'Description-nl'} // ()),
37 $exif->{Warning} ? "! $exif->{Warning}" : (),
42 my $filesize = (stat $file)[7];
45 open my $bin, '<', $file;
47 my $md5 = Digest::MD5->new->addfile($bin)->b64digest;
48 push @info, "# $md5 ($filesize)";
51 open my $pgm, '-|', convert => (
53 '+distort' => SRT => '0,0 1,.56 0',
54 -thumbnail => $size || '40x12',
58 if (<$pgm> eq "P2\n") {
59 my ($width, $height) = split ' ', <$pgm>;
60 <$pgm>; # ignore depth
61 my @ch = split //, " .:oO@";
63 print $ch[ $_ * @ch >> 8 ] for /\d+/g;
64 print ' ', shift @info if @info;
67 substr $_, 0, 0, ' ' x ($width + 1) for @info;