Raw

NAME

Image::Libexif::Raw - A simple interface to libexif

SYNOPSIS


use v6;

use Image::Libexif::Raw;
use Image::Libexif::Constants;
use NativeHelpers::Blob;

#| This program extracts an EXIF thumbnail from an image and saves it into a new file (in the same directory as the original).
sub MAIN($file! where { .IO.f // die "file '$file' not found" })
{
  my $l = exif_loader_new() // die ’Can't create an exif loader‘;
  # Load the EXIF data from the image file
  exif_loader_write_file($l, $file);
  # Get the EXIF data
  my $ed = exif_loader_get_data($l) // die ’Can't get the exif data‘;
  # The loader is no longer needed--free it
  exif_loader_unref($l);
  $l = Nil;
  if $ed.data && $ed.size {
    my $thumb-name = $file;
    $thumb-name ~~ s/\.jpg/_thumb.jpg/;
    my $data = blob-from-pointer($ed.data, :elems($ed.size), :type(Blob));
    spurt $thumb-name, $data, :bin;
  } else {
    say "No EXIF thumbnail in file $file";
  }
  # Free the EXIF data
  exif_data_unref($ed);
}


use v6;

use Image::Libexif::Raw;
use NativeCall;

#| This program dumps the EXIF content of its argument
sub MAIN($file! where { .IO.f // die "file $file not found" })
{
  my ExifData $exif = exif_data_new();
  $exif = exif_data_new_from_file($file);
  my Pointer $dummy .= new;
  exif_data_foreach_content($exif,
    sub (ExifContent $content, Pointer $dummy) {
      -> ExifContent $content {
        exif_content_dump($content, 0);
      }($content);
    },
    $dummy);
}

DESCRIPTION

For more details on libexif see https://github.com/libexif and https://libexif.github.io/docs.html.

Prerequisites

This module requires the libexif library to be installed. Please follow the instructions below based on your platform:

Debian Linux

sudo apt-get install libexif12

The module looks for a library called libexif.so.

Installation

To install it using zef (a module management tool):

$ zef install Image::Libexif

Testing

To run the tests:

$ prove -e "perl6 -Ilib"

Author

Fernando Santagata

License

The Artistic License 2.0

Image::Libexif v0.1.1

High-level bindings to libexif

Authors

  • Fernando Santagata

License

Artistic-2.0

Dependencies

NativeHelpers::Blob

Test Dependencies

Provides

  • Image::Libexif
  • Image::Libexif::Constants
  • Image::Libexif::Raw

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.