Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
image.h File Reference
#include "common/colorspaces.h"
#include "common/dtpthread.h"
#include "develop/format.h"
#include <glib.h>
#include <inttypes.h>
+ Include dependency graph for image.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_image_raw_parameters_t
 
struct  dt_image_geoloc_t
 
struct  dt_image_t
 

Typedefs

typedef enum dt_imageio_retval_t dt_imageio_retval_t
 
typedef enum dt_image_colorspace_t dt_image_colorspace_t
 
typedef struct dt_image_raw_parameters_t dt_image_raw_parameters_t
 
typedef enum dt_exif_image_orientation_t dt_exif_image_orientation_t
 
typedef enum dt_image_orientation_t dt_image_orientation_t
 
typedef enum dt_image_loader_t dt_image_loader_t
 
typedef enum dt_image_path_source_t dt_image_path_source_t
 
typedef struct dt_image_geoloc_t dt_image_geoloc_t
 
typedef struct dt_image_t dt_image_t
 

Enumerations

enum  dt_imageio_retval_t {
  DT_IMAGEIO_OK = 0 ,
  DT_IMAGEIO_FILE_NOT_FOUND ,
  DT_IMAGEIO_FILE_CORRUPTED ,
  DT_IMAGEIO_CACHE_FULL ,
  DT_IMAGEIO_UNSUPPORTED_FORMAT ,
  DT_IMAGEIO_UNSUPPORTED_FEATURE ,
  DT_IMAGEIO_UNSUPPORTED_CAMERA ,
  DT_IMAGEIO_LOAD_FAILED ,
  DT_IMAGEIO_IOERROR
}
 
enum  dt_image_flags_t {
  DT_IMAGE_REJECTED = 1 << 3 ,
  DT_IMAGE_THUMBNAIL_DEPRECATED = 1 << 4 ,
  DT_IMAGE_LDR = 1 << 5 ,
  DT_IMAGE_RAW = 1 << 6 ,
  DT_IMAGE_HDR = 1 << 7 ,
  DT_IMAGE_REMOVE = 1 << 8 ,
  DT_IMAGE_AUTO_PRESETS_APPLIED = 1 << 9 ,
  DT_IMAGE_NO_LEGACY_PRESETS = 1 << 10 ,
  DT_IMAGE_LOCAL_COPY = 1 << 11 ,
  DT_IMAGE_HAS_TXT = 1 << 12 ,
  DT_IMAGE_HAS_WAV = 1 << 13 ,
  DT_IMAGE_4BAYER = 1 << 14 ,
  DT_IMAGE_MONOCHROME = 1 << 15 ,
  DT_IMAGE_HAS_ADDITIONAL_DNG_TAGS = 1 << 16 ,
  DT_IMAGE_S_RAW = 1 << 17 ,
  DT_IMAGE_MONOCHROME_PREVIEW = 1 << 18 ,
  DT_IMAGE_MONOCHROME_BAYER = 1 << 19 ,
  DT_IMAGE_MONOCHROME_WORKFLOW = 1 << 20
}
 
enum  dt_image_colorspace_t {
  DT_IMAGE_COLORSPACE_NONE ,
  DT_IMAGE_COLORSPACE_SRGB ,
  DT_IMAGE_COLORSPACE_ADOBE_RGB
}
 
enum  dt_exif_image_orientation_t {
  EXIF_ORIENTATION_NONE = 1 ,
  EXIF_ORIENTATION_FLIP_HORIZONTALLY = 2 ,
  EXIF_ORIENTATION_FLIP_VERTICALLY = 4 ,
  EXIF_ORIENTATION_ROTATE_180_DEG = 3 ,
  EXIF_ORIENTATION_TRANSPOSE = 5 ,
  EXIF_ORIENTATION_ROTATE_CCW_90_DEG = 8 ,
  EXIF_ORIENTATION_ROTATE_CW_90_DEG = 6 ,
  EXIF_ORIENTATION_TRANSVERSE = 7
}
 
enum  dt_image_orientation_t {
  ORIENTATION_NULL = -1 ,
  ORIENTATION_NONE = 0 ,
  ORIENTATION_FLIP_Y = 1 << 0 ,
  ORIENTATION_FLIP_X = 1 << 1 ,
  ORIENTATION_SWAP_XY = 1 << 2 ,
  ORIENTATION_FLIP_HORIZONTALLY = ORIENTATION_FLIP_X ,
  ORIENTATION_FLIP_VERTICALLY = ORIENTATION_FLIP_Y ,
  ORIENTATION_ROTATE_180_DEG = ORIENTATION_FLIP_Y | ORIENTATION_FLIP_X ,
  ORIENTATION_TRANSPOSE = ORIENTATION_SWAP_XY ,
  ORIENTATION_ROTATE_CCW_90_DEG = ORIENTATION_FLIP_X | ORIENTATION_SWAP_XY ,
  ORIENTATION_ROTATE_CW_90_DEG = ORIENTATION_FLIP_Y | ORIENTATION_SWAP_XY ,
  ORIENTATION_TRANSVERSE = ORIENTATION_FLIP_Y | ORIENTATION_FLIP_X | ORIENTATION_SWAP_XY
}
 
enum  dt_image_loader_t {
  LOADER_UNKNOWN = 0 ,
  LOADER_TIFF = 1 ,
  LOADER_PNG = 2 ,
  LOADER_J2K = 3 ,
  LOADER_JPEG = 4 ,
  LOADER_EXR = 5 ,
  LOADER_RGBE = 6 ,
  LOADER_PFM = 7 ,
  LOADER_GM = 8 ,
  LOADER_RAWSPEED = 9 ,
  LOADER_PNM = 10 ,
  LOADER_AVIF = 11 ,
  LOADER_IM = 12 ,
  LOADER_HEIF = 13 ,
  LOADER_LIBRAW = 14 ,
  LOADER_WEBP = 15 ,
  LOADER_COUNT = 16
}
 
enum  dt_image_path_source_t {
  DT_IMAGE_PATH_NONE = 0 ,
  DT_IMAGE_PATH_LOCAL_COPY ,
  DT_IMAGE_PATH_LOCAL_COPY_LEGACY ,
  DT_IMAGE_PATH_ORIGINAL
}
 

Functions

void dt_image_init (dt_image_t *img)
 
void dt_image_refresh_makermodel (dt_image_t *img)
 
int dt_image_is_ldr (const dt_image_t *img)
 
int dt_image_is_raw (const dt_image_t *img)
 
int dt_image_is_hdr (const dt_image_t *img)
 
void dt_image_set_monochrome_flag (const int32_t imgid, gboolean monochrome)
 
gboolean dt_image_is_monochrome (const dt_image_t *img)
 
gboolean dt_image_is_matrix_correction_supported (const dt_image_t *img)
 
gboolean dt_image_is_rawprepare_supported (const dt_image_t *img)
 
int dt_image_monochrome_flags (const dt_image_t *img)
 
gboolean dt_image_use_monochrome_workflow (const dt_image_t *img)
 
void dt_image_print_debug_info (const dt_image_t *img, const char *context)
 
void dt_image_full_path (const int32_t imgid, char *pathname, size_t pathname_len, gboolean *from_cache, const char *calling_func)
 Get the full path of an image out of the database.
 
void dt_image_local_copy_paths_from_fullpath (const char *fullpath, int32_t imgid, char *local_copy_path, size_t local_copy_len, char *local_copy_legacy_path, size_t local_copy_legacy_len)
 
dt_image_path_source_t dt_image_choose_input_path (const dt_image_t *img, char *pathname, size_t pathname_len, gboolean force_cache)
 
void dt_image_film_roll_directory (const dt_image_t *img, char *pathname, size_t pathname_len)
 
const char * dt_image_film_roll_name (const char *path)
 
void dt_image_film_roll (const dt_image_t *img, char *pathname, size_t pathname_len)
 
void dt_image_path_append_version_no_db (int version, char *pathname, size_t pathname_len)
 
void dt_image_path_append_version (const int32_t imgid, char *pathname, size_t pathname_len)
 
void dt_image_print_exif (const dt_image_t *img, char *line, size_t line_len)
 
void dt_image_set_xmp_rating (dt_image_t *img, const int rating)
 
int dt_image_get_xmp_rating (const dt_image_t *img)
 
int dt_image_get_xmp_rating_from_flags (const int flags)
 
GList * dt_image_find_xmps (const char *filename)
 
int32_t dt_image_get_id_full_path (const gchar *filename)
 
int32_t dt_image_get_id (int32_t film_id, const gchar *filename)
 
int32_t dt_image_import (int32_t film_id, const char *filename, gboolean raise_signals)
 
int32_t dt_image_import_lua (int32_t film_id, const char *filename)
 
void dt_image_remove (const int32_t imgid)
 
int32_t dt_image_duplicate_with_version (const int32_t imgid, const int32_t newversion)
 
int32_t dt_image_duplicate (const int32_t imgid)
 
void dt_image_flip (const int32_t imgid, const int32_t cw)
 
void dt_image_set_flip (const int32_t imgid, const dt_image_orientation_t user_flip)
 
dt_image_orientation_t dt_image_get_orientation (const int32_t imgid)
 
void dt_image_set_location (const int32_t imgid, const dt_image_geoloc_t *geoloc, const gboolean undo_on, const gboolean group_on)
 
void dt_image_set_locations (const GList *img, const dt_image_geoloc_t *geoloc, const gboolean undo_on)
 
void dt_image_set_images_locations (const GList *imgs, const GArray *gloc, const gboolean undo_on)
 
void dt_image_get_location (const int32_t imgid, dt_image_geoloc_t *geoloc)
 
uint32_t dt_image_altered (const int32_t imgid)
 
void dt_image_cleanup (void)
 
static dt_image_orientation_t dt_image_orientation (const dt_image_t *img)
 
static dt_image_orientation_t dt_image_orientation_to_flip_bits (const int orient)
 
int32_t dt_image_move (const int32_t imgid, const int32_t filmid)
 
int32_t dt_image_rename (const int32_t imgid, const int32_t filmid, const gchar *newname)
 
int32_t dt_image_copy (const int32_t imgid, const int32_t filmid)
 
int32_t dt_image_copy_rename (const int32_t imgid, const int32_t filmid, const gchar *newname)
 
int dt_image_local_copy_set (const int32_t imgid)
 
int dt_image_local_copy_reset (const int32_t imgid)
 
gboolean dt_image_safe_remove (const int32_t imgid)
 
void dt_image_local_copy_synch ()
 
int dt_image_write_sidecar_file (const int32_t imgid)
 
void dt_image_synch_xmp (const int selected)
 
void dt_image_synch_xmps (const GList *img)
 
void dt_image_synch_all_xmp (const gchar *pathname)
 
gboolean dt_image_get_xmp_mode ()
 
void dt_image_set_datetime (const GList *imgs, const char *datetime, const gboolean undo_on)
 
void dt_image_set_datetimes (const GList *imgs, const GArray *dtime, const gboolean undo_on)
 
void dt_image_get_datetime (const int32_t imgid, char *datetime)
 
char * dt_image_get_audio_path (const int32_t imgid)
 
char * dt_image_get_audio_path_from_path (const char *image_path)
 
char * dt_image_get_text_path (const int32_t imgid)
 
char * dt_image_get_text_path_from_path (const char *image_path)
 
char * dt_image_build_text_path_from_path (const char *image_path)
 
float dt_image_get_exposure_bias (const struct dt_image_t *image_storage)
 
char * dt_image_camera_missing_sample_message (const struct dt_image_t *img, gboolean logmsg)
 
void dt_image_check_camera_missing_sample (const struct dt_image_t *img)
 
void dt_get_dirname_from_imgid (gchar *dir, const int32_t imgid)
 
int dt_image_read_duplicates (const uint32_t id, const char *filename, const gboolean clear_selection)
 

Variables

struct { 
 
   const char *   tooltip 
 
   const char   flag 
 
loaders_info [LOADER_COUNT
 

Typedef Documentation

◆ dt_exif_image_orientation_t

◆ dt_image_colorspace_t

◆ dt_image_geoloc_t

◆ dt_image_loader_t

◆ dt_image_orientation_t

◆ dt_image_path_source_t

◆ dt_image_raw_parameters_t

◆ dt_image_t

typedef struct dt_image_t dt_image_t

◆ dt_imageio_retval_t

return value of image io functions.

Enumeration Type Documentation

◆ dt_exif_image_orientation_t

Enumerator
EXIF_ORIENTATION_NONE 
EXIF_ORIENTATION_FLIP_HORIZONTALLY 
EXIF_ORIENTATION_FLIP_VERTICALLY 
EXIF_ORIENTATION_ROTATE_180_DEG 
EXIF_ORIENTATION_TRANSPOSE 
EXIF_ORIENTATION_ROTATE_CCW_90_DEG 
EXIF_ORIENTATION_ROTATE_CW_90_DEG 
EXIF_ORIENTATION_TRANSVERSE 

Definition at line 156 of file image.h.

◆ dt_image_colorspace_t

Enumerator
DT_IMAGE_COLORSPACE_NONE 
DT_IMAGE_COLORSPACE_SRGB 
DT_IMAGE_COLORSPACE_ADOBE_RGB 

Definition at line 143 of file image.h.

◆ dt_image_flags_t

Enumerator
DT_IMAGE_REJECTED 
DT_IMAGE_THUMBNAIL_DEPRECATED 
DT_IMAGE_LDR 
DT_IMAGE_RAW 
DT_IMAGE_HDR 
DT_IMAGE_REMOVE 
DT_IMAGE_AUTO_PRESETS_APPLIED 
DT_IMAGE_NO_LEGACY_PRESETS 
DT_IMAGE_LOCAL_COPY 
DT_IMAGE_HAS_TXT 
DT_IMAGE_HAS_WAV 
DT_IMAGE_4BAYER 
DT_IMAGE_MONOCHROME 
DT_IMAGE_HAS_ADDITIONAL_DNG_TAGS 
DT_IMAGE_S_RAW 
DT_IMAGE_MONOCHROME_PREVIEW 
DT_IMAGE_MONOCHROME_BAYER 
DT_IMAGE_MONOCHROME_WORKFLOW 

Definition at line 90 of file image.h.

◆ dt_image_loader_t

Enumerator
LOADER_UNKNOWN 
LOADER_TIFF 
LOADER_PNG 
LOADER_J2K 
LOADER_JPEG 
LOADER_EXR 
LOADER_RGBE 
LOADER_PFM 
LOADER_GM 
LOADER_RAWSPEED 
LOADER_PNM 
LOADER_AVIF 
LOADER_IM 
LOADER_HEIF 
LOADER_LIBRAW 
LOADER_WEBP 
LOADER_COUNT 

Definition at line 186 of file image.h.

◆ dt_image_orientation_t

Enumerator
ORIENTATION_NULL 
ORIENTATION_NONE 
ORIENTATION_FLIP_Y 
ORIENTATION_FLIP_X 
ORIENTATION_SWAP_XY 
ORIENTATION_FLIP_HORIZONTALLY 
ORIENTATION_FLIP_VERTICALLY 
ORIENTATION_ROTATE_180_DEG 
ORIENTATION_TRANSPOSE 
ORIENTATION_ROTATE_CCW_90_DEG 
ORIENTATION_ROTATE_CW_90_DEG 
ORIENTATION_TRANSVERSE 

Definition at line 168 of file image.h.

◆ dt_image_path_source_t

Enumerator
DT_IMAGE_PATH_NONE 
DT_IMAGE_PATH_LOCAL_COPY 
DT_IMAGE_PATH_LOCAL_COPY_LEGACY 
DT_IMAGE_PATH_ORIGINAL 

Definition at line 207 of file image.h.

◆ dt_imageio_retval_t

return value of image io functions.

Enumerator
DT_IMAGEIO_OK 
DT_IMAGEIO_FILE_NOT_FOUND 
DT_IMAGEIO_FILE_CORRUPTED 
DT_IMAGEIO_CACHE_FULL 
DT_IMAGEIO_UNSUPPORTED_FORMAT 
DT_IMAGEIO_UNSUPPORTED_FEATURE 
DT_IMAGEIO_UNSUPPORTED_CAMERA 
DT_IMAGEIO_LOAD_FAILED 
DT_IMAGEIO_IOERROR 

Definition at line 77 of file image.h.

Function Documentation

◆ dt_get_dirname_from_imgid()

void dt_get_dirname_from_imgid ( gchar *  dir,
const int32_t  imgid 
)

get dirname from imgid

Definition at line 3011 of file common/image.c.

References dt_image_full_path(), FALSE, and PATH_MAX.

Referenced by dt_collection_load_filmroll().

◆ dt_image_altered()

uint32_t dt_image_altered ( const int32_t  imgid)

◆ dt_image_build_text_path_from_path()

char * dt_image_build_text_path_from_path ( const char *  image_path)

Definition at line 2872 of file common/image.c.

References _text_path_legacy_build(), and IS_NULL_PTR.

Referenced by _import_copy_txt(), and _text_sidecar_save_path().

◆ dt_image_camera_missing_sample_message()

char * dt_image_camera_missing_sample_message ( const struct dt_image_t img,
gboolean  logmsg 
)

handle message for missing camera samples reported by rawspeed

Definition at line 2974 of file common/image.c.

References dt_image_t::camera_maker, dt_image_t::camera_model, dt_free, and dt_util_str_replace().

Referenced by dt_image_check_camera_missing_sample().

◆ dt_image_check_camera_missing_sample()

void dt_image_check_camera_missing_sample ( const struct dt_image_t img)

◆ dt_image_choose_input_path()

◆ dt_image_cleanup()

void dt_image_cleanup ( void  )

cleanup cached statements

Definition at line 1254 of file common/image.c.

References _image_altered_stmt, _image_stmt_mutex, _image_stmt_mutex_ensure(), dt_pthread_mutex_lock(), and dt_pthread_mutex_unlock().

Referenced by dt_cleanup().

◆ dt_image_copy()

int32_t dt_image_copy ( const int32_t  imgid,
const int32_t  filmid 
)

physically copy image to the folder of the film roll with filmid and duplicate update database entries.

Definition at line 2292 of file common/image.c.

References dt_image_copy_rename().

Referenced by dt_control_copy_images_job_run().

◆ dt_image_copy_rename()

int32_t dt_image_copy_rename ( const int32_t  imgid,
const int32_t  filmid,
const gchar *  newname 
)

◆ dt_image_duplicate()

int32_t dt_image_duplicate ( const int32_t  imgid)

duplicates the given image in the database.

Definition at line 1010 of file common/image.c.

References dt_image_duplicate_with_version().

Referenced by _history_style_apply(), and dt_control_duplicate_images_job_run().

◆ dt_image_duplicate_with_version()

int32_t dt_image_duplicate_with_version ( const int32_t  imgid,
const int32_t  newversion 
)

duplicates the given image in the database with the duplicate getting the supplied version number. if that version already exists just return the imgid without producing new duplicate. called with newversion -1 a new duplicate is produced with the next free version number.

Definition at line 1195 of file common/image.c.

References _image_duplicate_with_version(), and TRUE.

Referenced by dt_image_duplicate().

◆ dt_image_film_roll()

void dt_image_film_roll ( const dt_image_t img,
char *  pathname,
size_t  pathname_len 
)

returns the film roll name, i.e. without the path.

Definition at line 440 of file common/image.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_image_film_roll_name(), f, and dt_image_t::film_id.

◆ dt_image_film_roll_directory()

void dt_image_film_roll_directory ( const dt_image_t img,
char *  pathname,
size_t  pathname_len 
)

returns the full directory of the associated film roll.

Definition at line 424 of file common/image.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, f, and dt_image_t::film_id.

Referenced by _jump_to(), load_xmp_callback(), and update_preview_cb().

◆ dt_image_film_roll_name()

const char * dt_image_film_roll_name ( const char *  path)

returns the portion of the path used for the film roll name.

Definition at line 399 of file common/image.c.

References CLAMPS, and dt_conf_get_int().

Referenced by _populate_list(), dt_image_cache_write_release(), dt_image_film_roll(), dt_image_from_stmt(), and pretty_print_collection().

◆ dt_image_find_xmps()

GList * dt_image_find_xmps ( const char *  filename)

finds all xmp duplicates for the given image in the database.

Definition at line 1283 of file common/image.c.

References _valid_glob_match(), dt_util_test_image_file(), i, IS_NULL_PTR, PATH_MAX, and win_image_find_duplicates().

Referenced by _import_copy_xmp(), dt_control_delete_images_job_run(), and dt_image_read_duplicates().

◆ dt_image_flip()

◆ dt_image_full_path()

void dt_image_full_path ( const int32_t  imgid,
char *  pathname,
size_t  pathname_len,
gboolean *  from_cache,
const char *  calling_func 
)

Get the full path of an image out of the database.

returns the full path name where the image was imported from. from_cache=TRUE check and return local cached filename if any.

Parameters
imgidThe image ID.
pathnameA pointer storing the returned value from the sql request.
pathname_lenNumber of characters of the path set outside the function.
from_cacheBoolean, false returns the original file (file system), true prefers a local copy when available.
calling_funcPass FUNCTION for identifcation of callers of this function.

Definition at line 570 of file common/image.c.

References darktable, dt_image_cache_get(), dt_image_cache_read_release(), dt_image_choose_input_path(), DT_IMAGE_PATH_LOCAL_COPY, DT_IMAGE_PATH_LOCAL_COPY_LEGACY, DT_IMAGE_PATH_NONE, FALSE, darktable_t::image_cache, and TRUE.

Referenced by _event_dnd_get(), _set_image_paths(), _view_map_dnd_get_callback(), _watermark_get_svgdoc(), dt_control_delete_images_job_run(), dt_control_export_job_run(), dt_control_merge_hdr_job_run(), dt_control_refresh_exif_run(), dt_drawlayer_io_sidecar_path(), dt_exif_xmp_attach_export(), dt_exif_xmp_read_string(), dt_get_dirname_from_imgid(), dt_get_lightroom_xmp(), dt_image_copy_rename(), dt_image_find_best_color_profile(), dt_image_get_audio_path(), dt_image_get_text_path(), dt_image_local_copy_reset(), dt_image_local_copy_synch(), dt_image_rename(), dt_image_safe_remove(), dt_imageio_export_with_flags(), dt_view_image_info_update(), store(), store(), try_enter(), and write_image().

◆ dt_image_get_audio_path()

char * dt_image_get_audio_path ( const int32_t  imgid)

helper function to get the audio file filename that is accompanying the image. g_free() after use

Definition at line 2819 of file common/image.c.

References dt_image_full_path(), dt_image_get_audio_path_from_path(), FALSE, and PATH_MAX.

Referenced by dt_view_audio_start().

◆ dt_image_get_audio_path_from_path()

char * dt_image_get_audio_path_from_path ( const char *  image_path)

Definition at line 2796 of file common/image.c.

References dt_free.

Referenced by _image_import_internal(), and dt_image_get_audio_path().

◆ dt_image_get_datetime()

◆ dt_image_get_exposure_bias()

float dt_image_get_exposure_bias ( const struct dt_image_t image_storage)

Definition at line 2958 of file common/image.c.

References dt_image_t::exif_exposure_bias.

Referenced by reload_defaults().

◆ dt_image_get_id()

int32_t dt_image_get_id ( int32_t  film_id,
const gchar *  filename 
)

◆ dt_image_get_id_full_path()

int32_t dt_image_get_id_full_path ( const gchar *  filename)

get image id by filename

Definition at line 1675 of file common/image.c.

References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, and dt_free.

Referenced by dt_image_synch_all_xmp().

◆ dt_image_get_location()

◆ dt_image_get_orientation()

◆ dt_image_get_text_path()

char * dt_image_get_text_path ( const int32_t  imgid)

helper function to get the text file filename that is accompanying the image. g_free() after use

Definition at line 2939 of file common/image.c.

References dt_image_full_path(), dt_image_get_text_path_from_path(), FALSE, PATH_MAX, and TRUE.

Referenced by _get_base_value().

◆ dt_image_get_text_path_from_path()

char * dt_image_get_text_path_from_path ( const char *  image_path)

◆ dt_image_get_xmp_mode()

◆ dt_image_get_xmp_rating()

int dt_image_get_xmp_rating ( const dt_image_t img)

Definition at line 678 of file common/image.c.

References dt_image_get_xmp_rating_from_flags(), and dt_image_t::flags.

◆ dt_image_get_xmp_rating_from_flags()

int dt_image_get_xmp_rating_from_flags ( const int  flags)

◆ dt_image_import()

int32_t dt_image_import ( int32_t  film_id,
const char *  filename,
gboolean  raise_signals 
)

imports a new image from raw/etc file and adds it to the data base and image cache. Use from threads other than lua.

Definition at line 1714 of file common/image.c.

References _image_import_internal(), and TRUE.

Referenced by _film_import1(), _import_job(), dt_control_merge_hdr_job_run(), dt_image_import_job_run(), dt_load_from_string(), and main().

◆ dt_image_import_lua()

int32_t dt_image_import_lua ( int32_t  film_id,
const char *  filename 
)

imports a new image from raw/etc file and adds it to the data base and image cache. Use from lua thread.

Definition at line 1719 of file common/image.c.

References _image_import_internal(), FALSE, and TRUE.

◆ dt_image_init()

void dt_image_init ( dt_image_t img)

inits basic values to sensible defaults.

Definition at line 1724 of file common/image.c.

References dt_image_t::adobe_XYZ_to_CAM, dt_image_t::cache_entry, dt_image_t::camera_alias, dt_image_t::camera_legacy_makermodel, dt_image_t::camera_maker, dt_image_t::camera_makermodel, dt_image_t::camera_missing_sample, dt_image_t::camera_model, dt_image_t::change_timestamp, dt_iop_buffer_dsc_t::channels, dt_image_t::color_labels, dt_image_t::colorspace, dt_image_t::crop_height, dt_image_t::crop_width, dt_image_t::crop_x, dt_image_t::crop_y, dt_image_t::d65_color_matrix, dt_image_t::datetime, dt_image_t::dng_gain_maps, dt_image_t::dsc, dt_datetime_exif_to_img(), DT_IMAGE_COLORSPACE_NONE, dt_image_geoloc_t::elevation, dt_image_t::exif_aperture, dt_image_t::exif_crop, dt_image_t::exif_exposure, dt_image_t::exif_exposure_bias, dt_image_t::exif_focal_length, dt_image_t::exif_focus_distance, dt_image_t::exif_inited, dt_image_t::exif_iso, dt_image_t::exif_lens, dt_image_t::exif_maker, dt_image_t::exif_model, dt_image_t::export_timestamp, FALSE, dt_image_t::filename, dt_image_t::film_id, dt_image_t::filmroll, dt_image_t::flags, dt_image_t::folder, dt_image_t::fuji_rotation_pos, dt_image_t::fullpath, dt_image_t::geoloc, dt_image_t::group_id, dt_image_t::group_members, dt_image_t::has_audio, dt_image_t::has_localcopy, dt_image_t::height, dt_image_t::history_hash, dt_image_t::history_items, i, dt_image_t::id, dt_image_t::import_timestamp, dt_image_t::is_bw, dt_image_t::is_bw_flow, dt_image_t::is_hdr, k, dt_image_geoloc_t::latitude, dt_image_raw_parameters_t::legacy, dt_image_t::legacy_flip, dt_image_t::loader, LOADER_UNKNOWN, dt_image_t::local_copy_legacy_path, dt_image_t::local_copy_path, dt_image_geoloc_t::longitude, dt_image_t::mipmap_hash, dt_image_t::orientation, ORIENTATION_NULL, dt_image_t::p_height, dt_image_t::p_width, dt_image_t::pixel_aspect_ratio, dt_image_t::print_timestamp, dt_image_t::profile, dt_image_t::profile_size, dt_image_t::rating, dt_image_t::raw_black_level, dt_image_t::raw_black_level_separate, dt_image_t::raw_white_point, dt_image_t::self_hash, TYPE_UNKNOWN, UNKNOWN_IMAGE, dt_image_raw_parameters_t::user_flip, dt_image_t::usercrop, dt_image_t::version, dt_image_t::wb_coeffs, and dt_image_t::width.

Referenced by _dt_collection_lut(), _import_copy_file(), _set_test_path(), dt_dev_init(), dt_image_cache_allocate(), and update_preview_cb().

◆ dt_image_is_hdr()

◆ dt_image_is_ldr()

int dt_image_is_ldr ( const dt_image_t img)

returns non-zero if the image contains low-dynamic range data.

Definition at line 162 of file common/image.c.

References DT_IMAGE_LDR, dt_image_t::filename, and dt_image_t::flags.

Referenced by _exif_decode_exif_data(), and dt_image_print_debug_info().

◆ dt_image_is_matrix_correction_supported()

◆ dt_image_is_monochrome()

◆ dt_image_is_raw()

◆ dt_image_is_rawprepare_supported()

gboolean dt_image_is_rawprepare_supported ( const dt_image_t img)

returns non-zero if the image supports the rawprepare module

Definition at line 277 of file common/image.c.

References DT_IMAGE_RAW, DT_IMAGE_S_RAW, FALSE, dt_image_t::flags, and TRUE.

Referenced by _dev_auto_apply_presets(), _gui_presets_popup_menu_show_internal(), commit_params(), dt_gui_presets_autoapply_for_module(), enable(), and gui_update().

◆ dt_image_local_copy_paths_from_fullpath()

void dt_image_local_copy_paths_from_fullpath ( const char *  fullpath,
int32_t  imgid,
char *  local_copy_path,
size_t  local_copy_len,
char *  local_copy_legacy_path,
size_t  local_copy_legacy_len 
)

pregenerate modern and legacy pathes to local copies from full path

Definition at line 600 of file common/image.c.

References dt_free, dt_loc_get_user_cache_dir(), IS_NULL_PTR, and PATH_MAX.

Referenced by dt_image_cache_write_release(), and dt_image_from_stmt().

◆ dt_image_local_copy_reset()

◆ dt_image_local_copy_set()

◆ dt_image_local_copy_synch()

◆ dt_image_monochrome_flags()

◆ dt_image_move()

int32_t dt_image_move ( const int32_t  imgid,
const int32_t  filmid 
)

physically move image with imgid and its duplicates to the film roll given by filmid. returns -1 on error, 0 on success.

Definition at line 2028 of file common/image.c.

References dt_image_rename().

Referenced by _drop_move_to_folder(), and dt_control_move_images_job_run().

◆ dt_image_orientation()

static dt_image_orientation_t dt_image_orientation ( const dt_image_t img)
inlinestatic

returns the orientation bits of the image from exif.

Definition at line 441 of file image.h.

References dt_image_t::orientation, ORIENTATION_NONE, and ORIENTATION_NULL.

Referenced by _flip_h(), _flip_v(), commit_params(), do_rotate(), dt_image_get_orientation(), dt_masks_legacy_params_v1_to_v2(), legacy_params(), and reload_defaults().

◆ dt_image_orientation_to_flip_bits()

◆ dt_image_path_append_version()

void dt_image_path_append_version ( const int32_t  imgid,
char *  pathname,
size_t  pathname_len 
)

◆ dt_image_path_append_version_no_db()

void dt_image_path_append_version_no_db ( int  version,
char *  pathname,
size_t  pathname_len 
)

appends version numbering for duplicated images without querying the db.

Definition at line 627 of file common/image.c.

References c2, and dt_free.

Referenced by dt_control_crawler_run(), and dt_image_path_append_version().

◆ dt_image_print_debug_info()

void dt_image_print_debug_info ( const dt_image_t img,
const char *  context 
)

debug helper: dump image flags and buffer details (DT_DEBUG_IMAGEIO)

Definition at line 323 of file common/image.c.

References _image_buf_type_to_string(), _image_colorspace_to_string(), bit_depth, dt_iop_buffer_dsc_t::bpp, bpp, dt_iop_buffer_dsc_t::channels, dt_image_t::colorspace, dt_image_t::crop_height, dt_image_t::crop_width, dt_image_t::crop_x, dt_image_t::crop_y, dt_iop_buffer_dsc_t::cst, dt_image_t::d65_color_matrix, dt_iop_buffer_dsc_t::datatype, dt_image_t::dsc, DT_DEBUG_IMAGEIO, DT_IMAGE_4BAYER, DT_IMAGE_AUTO_PRESETS_APPLIED, DT_IMAGE_HAS_ADDITIONAL_DNG_TAGS, DT_IMAGE_HAS_TXT, DT_IMAGE_HAS_WAV, dt_image_is_hdr(), dt_image_is_ldr(), dt_image_is_monochrome(), dt_image_is_raw(), DT_IMAGE_LOCAL_COPY, DT_IMAGE_MONOCHROME_BAYER, dt_image_monochrome_flags(), DT_IMAGE_MONOCHROME_PREVIEW, DT_IMAGE_NO_LEGACY_PRESETS, DT_IMAGE_REJECTED, DT_IMAGE_REMOVE, DT_IMAGE_S_RAW, dt_image_use_monochrome_workflow(), dt_print(), dt_image_t::filename, dt_iop_buffer_dsc_t::filters, dt_image_t::flags, flags, dt_image_t::fullpath, dt_image_t::has_audio, dt_image_t::has_localcopy, dt_image_t::height, dt_image_t::id, dt_image_t::is_bw, dt_image_t::is_bw_flow, dt_image_t::is_hdr, IS_NULL_PTR, dt_image_t::orientation, dt_image_t::p_height, dt_image_t::p_width, dt_image_t::pixel_aspect_ratio, dt_iop_buffer_dsc_t::processed_maximum, dt_image_t::raw_black_level, dt_iop_buffer_dsc_t::raw_black_level, dt_image_t::raw_black_level_separate, dt_image_t::raw_white_point, dt_iop_buffer_dsc_t::raw_white_point, dt_iop_buffer_dsc_t::rawprepare, TYPE_FLOAT, TYPE_UINT16, TYPE_UINT8, TYPE_UNKNOWN, and dt_image_t::width.

Referenced by reload_defaults().

◆ dt_image_print_exif()

void dt_image_print_exif ( const dt_image_t img,
char *  line,
size_t  line_len 
)

prints a one-line exif information string.

Definition at line 661 of file common/image.c.

References dt_free, dt_util_format_exposure(), dt_image_t::exif_aperture, dt_image_t::exif_exposure, dt_image_t::exif_focal_length, and dt_image_t::exif_iso.

Referenced by _get_base_value(), and finalize_store().

◆ dt_image_read_duplicates()

◆ dt_image_refresh_makermodel()

◆ dt_image_remove()

◆ dt_image_rename()

int32_t dt_image_rename ( const int32_t  imgid,
const int32_t  filmid,
const gchar *  newname 
)

physically move image with imgid and its duplicates to the film roll given by filmid and the name given by newname. returns -1 on error, 0 on success.

Todo:
: several places where string truncation could occur unnoticed

Definition at line 1826 of file common/image.c.

References _move_text_sidecar_if_present(), darktable, darktable_t::db, dt_control_log(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_image_cache_get(), dt_image_cache_read_release(), DT_IMAGE_CACHE_SAFE, dt_image_cache_write_release(), dt_image_choose_input_path(), dt_image_full_path(), dt_image_path_append_version(), DT_MAX_FILENAME_LEN, FALSE, dt_image_t::filename, dt_image_t::film_id, darktable_t::image_cache, PATH_MAX, and TRUE.

Referenced by dt_image_move().

◆ dt_image_safe_remove()

gboolean dt_image_safe_remove ( const int32_t  imgid)

◆ dt_image_set_datetime()

void dt_image_set_datetime ( const GList *  imgs,
const char *  datetime,
const gboolean  undo_on 
)

◆ dt_image_set_datetimes()

void dt_image_set_datetimes ( const GList *  imgs,
const GArray *  dtime,
const gboolean  undo_on 
)

◆ dt_image_set_flip()

◆ dt_image_set_images_locations()

void dt_image_set_images_locations ( const GList *  imgs,
const GArray *  gloc,
const gboolean  undo_on 
)

◆ dt_image_set_location()

void dt_image_set_location ( const int32_t  imgid,
const dt_image_geoloc_t geoloc,
const gboolean  undo_on,
const gboolean  group_on 
)

set image location lon/lat/ele

Definition at line 843 of file common/image.c.

References dt_act_on_get_images(), dt_grouping_add_grouped_images(), dt_image_set_locations(), and UNKNOWN_IMAGE.

Referenced by dt_lightroom_import().

◆ dt_image_set_locations()

void dt_image_set_locations ( const GList *  img,
const dt_image_geoloc_t geoloc,
const gboolean  undo_on 
)

◆ dt_image_set_monochrome_flag()

void dt_image_set_monochrome_flag ( const int32_t  imgid,
gboolean  monochrome 
)

set the monochrome flags if monochrome is TRUE and clear it otherwise

Definition at line 244 of file common/image.c.

References _image_set_monochrome_flag(), and TRUE.

Referenced by dt_control_monochrome_images_job_run().

◆ dt_image_set_xmp_rating()

void dt_image_set_xmp_rating ( dt_image_t img,
const int  rating 
)

◆ dt_image_synch_all_xmp()

◆ dt_image_synch_xmp()

◆ dt_image_synch_xmps()

◆ dt_image_use_monochrome_workflow()

gboolean dt_image_use_monochrome_workflow ( const dt_image_t img)

returns true if the image has been tested to be monochrome and the image wants monochrome workflow

Definition at line 282 of file common/image.c.

References DT_IMAGE_MONOCHROME, DT_IMAGE_MONOCHROME_BAYER, DT_IMAGE_MONOCHROME_PREVIEW, DT_IMAGE_MONOCHROME_WORKFLOW, and dt_image_t::flags.

Referenced by dt_image_cache_write_release(), dt_image_from_stmt(), and dt_image_print_debug_info().

◆ dt_image_write_sidecar_file()

Variable Documentation

◆ flag

◆ [struct]

const struct { ... } loaders_info[LOADER_COUNT]
Initial value:
=
{
{ N_("unknown"), '.'},
{ N_("tiff"), 't'},
{ N_("png"), 'p'},
{ N_("j2k"), 'J'},
{ N_("jpeg"), 'j'},
{ N_("exr"), 'e'},
{ N_("rgbe"), 'R'},
{ N_("pfm"), 'P'},
{ N_("GraphicsMagick"), 'g'},
{ N_("rawspeed"), 'r'},
{ N_("netpnm"), 'n'},
{ N_("avif"), 'a'},
{ N_("ImageMagick"), 'i'},
{ N_("heif"), 'h'},
{ N_("libraw"), 'l'},
{ N_("webp"), 'w'}
}

Referenced by _metadata_get_flags().

◆ tooltip