App-Exifpic
view release on metacpan or search on metacpan
"runtime" : {
"requires" : {
"File::Slurp" : "0",
"Image::ExifTool" : "0",
"Imager" : "0",
"Thread::Queue" : "0",
"autodie" : "0",
"constant" : "0",
"perl" : "5.010",
"strict" : "0",
"threads" : "0",
"warnings" : "0"
}
}
},
"release_status" : "stable",
"resources" : {
"repository" : {
"type" : "git",
"url" : "git://github.com/pfenwick/app-exifpic.git",
"web" : "https://github.com/pfenwick/app-exifpic"
name: App-Exifpic
requires:
File::Slurp: 0
Image::ExifTool: 0
Imager: 0
Thread::Queue: 0
autodie: 0
constant: 0
perl: 5.010
strict: 0
threads: 0
warnings: 0
resources:
repository: git://github.com/pfenwick/app-exifpic.git
version: 0.02
Makefile.PL view on Meta::CPAN
"LICENSE" => "perl",
"NAME" => "App::Exifpic",
"PREREQ_PM" => {
"File::Slurp" => 0,
"Image::ExifTool" => 0,
"Imager" => 0,
"Thread::Queue" => 0,
"autodie" => 0,
"constant" => 0,
"strict" => 0,
"threads" => 0,
"warnings" => 0
},
"VERSION" => "0.02",
"test" => {
"TESTS" => "t/*.t"
}
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
$ exifpic *.CR2
=head1 DESCRIPTION
This is a super-simple program to extract embedded (full-size) jpegs
from RAW camera files. EXIF headers are copied to the new file, which
will always have the same name as the old file, but with a .jpg extension.
The code will use as many cores as you have available, and assumes you're
running a threaded perl.
=head1 BUGS
Plenty! The code assumes you have a F</proc/cpuinfo> so it can count
cores. It's only been tested on Canon .CR2 files. There are probably
more.
Patches are I<super-welcome>. You can find the code repo at
L<https://github.com/pfenwick/app-exifpic> .
bin/exifpic view on Meta::CPAN
$ exifpic *.CR2
=head1 DESCRIPTION
This is a super-simple program to extract embedded (full-size) jpegs
from RAW camera files. EXIF headers are copied to the new file, which
will always have the same name as the old file, but with a .jpg extension.
The code will use as many cores as you have available, and assumes you're
running a threaded perl.
The code will always scale pictures so the longest side is 2048px or less.
A patch to allow users to select sizes would be great. :)
=head1 BUGS
Plenty! The code assumes you have a F</proc/cpuinfo> so it can count
cores. It's only been tested on Canon .CR2 files. There are probably
more.
lib/App/Exifpic.pm view on Meta::CPAN
package App::Exifpic;
use 5.010;
use strict;
use warnings;
use threads;
use Thread::Queue;
use autodie;
use Image::ExifTool;
use Imager;
use File::Slurp qw(read_file);
use constant EXIT_SUCCESS => 0;
# ABSTRACT: Extract embedded jpegs from RAW files
our $VERSION = '0.02'; # VERSION: Generated by DZP::OurPkg:Version
# Run our application...
sub run {
my ($self) = shift;
# Imager needs to be preloaded if we're using threads.
Imager->preload;
# Right now we treat everything as a file to process...
my $work_queue = Thread::Queue->new;
$work_queue->enqueue(@_);
$work_queue->end;
# Spawn our threads, each of which will process files until we're done.
my @threads;
my $cores = $self->get_cores();
# TODO: This could look less ugly
for (1..$cores) {
push(@threads,
threads->create( sub {
while (my $src = $work_queue->dequeue) {
$self->process_image($src);
}
})
);
}
# Join threads.
foreach my $thread (@threads) { $thread->join; }
return EXIT_SUCCESS;
}
sub process_image {
my ($self, $raw) = @_;
my ($new) = $raw =~ m{(.*).CR2$}i;
( run in 0.878 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )