Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 38 lines (26 sloc) 0.765 kB
#!/usr/bin/env perl
use warnings;
use strict;
use MIME::Base64;
use Image::ExifTool;
use Path::Class qw( file );
#---------------------------------------------------------------------
my $max_k = 7.5;
my $img = file(shift || die "Give me an image file.\n");
-e $img || die "Can't find $img, tough guy.\n";
die "That's too big for this kind of thing; ${max_k}K max.\n"
if -s $img > $max_k * 1_024;
my $exif = Image::ExifTool->new;
my $info = $exif->ImageInfo($img->stringify);
use YAML; print YAML::Dump($info);
my $src = sprintf "data:%s;base64,%s",
$info->{MIMEType},
encode_base64($img->slurp);
$src =~ s/\R//g;
print $src, $/;
exit 0;
__DATA__
# For wrapped output.
use Text::Wrap;
$Text::Wrap::columns = 72;
print wrap("", "", $src), $/;
Jump to Line
Something went wrong with that request. Please try again.