else
if (options->metadata.write_orientation)
{
- orientation = metadata_read_int(fd_n, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
+ if (g_strcmp0(imd->image_fd->format_name, "heif") == 0)
+ {
+ orientation = EXIF_ORIENTATION_TOP_LEFT;
+ }
+ else
+ {
+ orientation = metadata_read_int(fd_n, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
+ }
}
}
if (orientation != (fd_n->exif_orientation ? fd_n->exif_orientation : 1))
{
- if (!options->metadata.write_orientation)
+ if (g_strcmp0(fd_n->format_name, "heif") != 0)
+ {
+ if (!options->metadata.write_orientation)
+ {
+ /* user_orientation does not work together with options->metadata.write_orientation,
+ use either one or the other.
+ we must however handle switching metadata.write_orientation on and off, therefore
+ we just disable referencing new fd's, not unreferencing the old ones
+ */
+ if (fd_n->user_orientation == 0) file_data_ref(fd_n);
+ fd_n->user_orientation = orientation;
+ }
+ }
+ else
{
- /* user_orientation does not work together with options->metadata.write_orientation,
- use either one or the other.
- we must however handle switching metadata.write_orientation on and off, therefore
- we just disable referencing new fd's, not unreferencing the old ones
- */
if (fd_n->user_orientation == 0) file_data_ref(fd_n);
fd_n->user_orientation = orientation;
}
fd_n->user_orientation = 0;
}
- if (options->metadata.write_orientation)
+ if (g_strcmp0(fd_n->format_name, "heif") != 0)
{
- if (type == ALTER_NONE)
- {
- metadata_write_revert(fd_n, ORIENTATION_KEY);
- }
- else
+ if (options->metadata.write_orientation)
{
- metadata_write_int(fd_n, ORIENTATION_KEY, orientation);
+ if (type == ALTER_NONE)
+ {
+ metadata_write_revert(fd_n, ORIENTATION_KEY);
+ }
+ else
+ {
+ metadata_write_int(fd_n, ORIENTATION_KEY, orientation);
+ }
}
}
}
else if (options->image.exif_rotate_enable)
{
- imd->orientation = metadata_read_int(imd->image_fd, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
- imd->image_fd->exif_orientation = imd->orientation;
+ if (g_strcmp0(imd->image_fd->format_name, "heif") == 0)
+ {
+ imd->orientation = EXIF_ORIENTATION_TOP_LEFT;
+ imd->image_fd->exif_orientation = imd->orientation;
+ }
+ else
+ {
+ imd->orientation = metadata_read_int(imd->image_fd, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
+ imd->image_fd->exif_orientation = imd->orientation;
+ }
}
}