Imager

 view release on metacpan or  search on metacpan

imexif.c  view on Meta::CPAN

    { 3, "Two-chip color area sensor" },
    { 4, "Three-chip color area sensor" },
    { 5, "Color sequential area sensor" },
    { 7, "Trilinear sensor" },
    { 8, "Color sequential linear sensor" },
  };

static tag_map custom_rendered_values[] =
  {
    { 0, "Normal process" },
    { 1, "Custom process" },
  };

static tag_map white_balance_values[] =
  {
    { 0, "Auto white balance" },
    { 1, "Manual white balance" },
  };

static tag_map scene_capture_type_values[] =
  {
    { 0, "Standard" },
    { 1, "Landscape" },
    { 2, "Portrait" },
    { 3, "Night scene" },
  };

static tag_map gain_control_values[] =
  {
    { 0, "None" },
    { 1, "Low gain up" },
    { 2, "High gain up" },
    { 3, "Low gain down" },
    { 4, "High gain down" },
  };

static tag_map contrast_values[] =
  {
    { 0, "Normal" },
    { 1, "Soft" },
    { 2, "Hard" },
  };

static tag_map saturation_values[] =
  {
    { 0, "Normal" },
    { 1, "Low saturation" },
    { 2, "High saturation" },
  };

static tag_map sharpness_values[] =
  {
    { 0, "Normal" },
    { 1, "Soft" },
    { 2, "Hard" },
  };

static tag_map subject_distance_range_values[] =
  {
    { 0, "unknown" },
    { 1, "Macro" },
    { 2, "Close view" },
    { 3, "Distant view" },
  };

#define focal_plane_resolution_unit_values resolution_unit_values

static tag_value_map exif_ifd_values[] =
  {
    VALUE_MAP_ENTRY(exposure_mode),
    VALUE_MAP_ENTRY(color_space),
    VALUE_MAP_ENTRY(exposure_program),
    VALUE_MAP_ENTRY(metering_mode),
    VALUE_MAP_ENTRY(light_source),
    VALUE_MAP_ENTRY(flash),
    VALUE_MAP_ENTRY(sensing_method),
    VALUE_MAP_ENTRY(custom_rendered),
    VALUE_MAP_ENTRY(white_balance),
    VALUE_MAP_ENTRY(scene_capture_type),
    VALUE_MAP_ENTRY(gain_control),
    VALUE_MAP_ENTRY(contrast),
    VALUE_MAP_ENTRY(saturation),
    VALUE_MAP_ENTRY(sharpness),
    VALUE_MAP_ENTRY(subject_distance_range),
    VALUE_MAP_ENTRY(focal_plane_resolution_unit),
  };

static tag_map exif_num_arrays[] =
  {
    { tag_iso_speed_ratings, "exif_iso_speed_ratings" },
    { tag_subject_area, "exif_subject_area" },
    { tag_subject_location, "exif_subject_location" },
  };

static void
save_exif_ifd_tags(i_img *im, imtiff *tiff) {
  int i, tag_index;
  ifd_entry *entry;
  char *user_comment;
  unsigned long maker_note_offset = 0;
  size_t maker_note_size = 0;

  for (tag_index = 0, entry = tiff->ifd; 
       tag_index < tiff->ifd_size; ++tag_index, ++entry) {
    switch (entry->tag) {
    case tag_user_comment:
      /* I don't want to trash the source, so work on a copy */
      user_comment = mymalloc(entry->size);
      memcpy(user_comment, tiff->base + entry->offset, entry->size);
      /* the first 8 bytes indicate the encoding, make them into spaces
	 for better presentation */
      for (i = 0; i < entry->size && i < 8; ++i) {
	if (user_comment[i] == '\0')
	  user_comment[i] = ' ';
      }
      /* find the actual end of the string */
      while (i < entry->size && user_comment[i])
	++i;
      i_tags_set(&im->tags, "exif_user_comment", user_comment, i);
      myfree(user_comment);
      break;



( run in 2.598 seconds using v1.01-cache-2.11-cpan-98e64b0badf )