Skip to content

Metadata is lost after conversion #24

@JarlenJohn

Description

@JarlenJohn

After decoding the HEIC picture with this library, all the meta information is lost. I wonder if other information except the rotation field can be retained?
After reviewing the libheif source code, I found the following method:

size_t exifsize = 0;
  uint8_t* exifdata = GetExifMetaData(handle, &exifsize);
  if (exifdata && exifsize > 4) {
    static const uint8_t kExifMarker = JPEG_APP0 + 1;
    jpeg_write_marker(&cinfo, kExifMarker, exifdata + 4,
                      static_cast<unsigned int>(exifsize - 4));
    free(exifdata);
  }

  size_t profile_size = heif_image_handle_get_raw_color_profile_size(handle);
  if (profile_size > 0) {
    uint8_t* profile_data = static_cast<uint8_t*>(malloc(profile_size));
    heif_image_handle_get_raw_color_profile(handle, profile_data);
    jpeg_write_icc_profile(&cinfo, profile_data, (unsigned int) profile_size);
    free(profile_data);
  }


  if (heif_image_get_bits_per_pixel(image, heif_channel_Y) != 8) {
    fprintf(stderr, "JPEG writer cannot handle image with >8 bpp.\n");
    return false;
  }
.......

But my C++ is very poor, do not know how to convert to OC code,any body have some idea? i'll be very thankful!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions