73#define DT_MAX_STYLE_NAME_LENGTH 128
76#define DT_MAX_OUTPUT_EXT_LENGTH 5
78static void usage(
const char *progname)
80 fprintf(
stderr,
"usage: %s [<input file or dir>] [<xmp file>] <output destination> [options] [--core <darktable options>]\n", progname);
83 fprintf(
stderr,
" --width <max width> default: 0 = full resolution\n");
84 fprintf(
stderr,
" --height <max height> default: 0 = full resolution\n");
86 fprintf(
stderr,
" --export_masks <0|1|false|true>, default: false\n");
88 fprintf(
stderr,
" --apply-custom-presets <0|1|false|true>, default: true\n");
90 fprintf(
stderr,
" --out-ext <extension>, default from output destination or '.jpg'\n");
91 fprintf(
stderr,
" if specified, takes preference over output\n");
92 fprintf(
stderr,
" --import <file or dir> specify input file or dir, can be used'\n");
94 fprintf(
stderr,
" --imgid <id> process an image already in the library, using its\n");
95 fprintf(
stderr,
" editing history from library.db (no input file, no XMP;\n");
96 fprintf(
stderr,
" can be used multiple times; only the output is positional)\n");
98 fprintf(
stderr,
" the output destination may contain $(VARIABLES) expanded by the disk\n");
99 fprintf(
stderr,
" storage, e.g. '/path/$(FILE_NAME)-myfix' with --out-ext tiff produces\n");
101 fprintf(
stderr,
" --icc-type <type> specify icc type, default to NONE\n");
102 fprintf(
stderr,
" use --help icc-type for list of supported types\n");
103 fprintf(
stderr,
" --icc-file <file> specify icc filename, default to NONE\n");
104 fprintf(
stderr,
" --icc-intent <intent> specify icc intent, default to LAST\n");
105 fprintf(
stderr,
" use --help icc-intent for list of supported intents\n");
144#define ICC_FROM_STR(name) if(!strcmp(option, #name)) return DT_COLORSPACE_ ## name;
187#define ICC_INTENT_FROM_STR(name) if(!strcmp(option, #name)) return DT_INTENT_ ## name;
196#undef ICC_INTENT_FROM_STR
229 gchar *icc_filename =
NULL;
250 printf(
"this is ansel-cli %s\ncopyright (c) 2012-%s johannes hanika, tobias ellinghaus\n",
268 fprintf(
stderr,
_(
"TODO: sorry, due to API restrictions we currently cannot set the BPP to %d.\n"),
bpp);
275 export_masks =
FALSE;
329 fprintf(
stderr,
_(
"notice: input file or dir '%s' doesn't exist, skipping\n"),
arg[
k]);
433 fprintf(
stderr,
_(
"error: --imgid cannot be combined with input files or an XMP (history comes from library.db)\n"));
435 fprintf(
stderr,
_(
"error: --imgid requires an output destination\n"));
501 fprintf(
stderr,
_(
"error: input file and import opts specified! that's not supported!\n"));
554 fprintf(
stderr,
"%s\n",
_(
"output file already exists, it will get renamed"));
585 if(image && image->
id == imgid)
594 fprintf(
stderr,
_(
"error: no image with id %d in the library"), imgid);
604 gchar* input = l->data;
690 printf(
"[%s]\n",
_(
"empty history stack"));
749 _(
"cannot find disk storage module. please check your installation, something seems to be broken."));
756 sdata = storage->get_params(storage);
759 fprintf(
stderr,
"%s\n",
_(
"failed to get parameters from storage module, aborting export ..."));
782 fdata = format->get_params(format);
785 fprintf(
stderr,
"%s\n",
_(
"failed to get parameters from format module, aborting export ..."));
791 uint32_t w, h,
fw,
fh,
sw, sh;
793 storage->dimension(storage, sdata, &
sw, &sh);
794 format->dimension(format,
fdata, &
fw, &
fh);
796 if(
sw == 0 ||
fw == 0)
801 if(sh == 0 ||
fh == 0)
802 h = sh >
fh ? sh :
fh;
804 h = sh <
fh ? sh :
fh;
808 fdata->max_width = (w != 0 &&
fdata->max_width > w) ? w :
fdata->max_width;
809 fdata->max_height = (h != 0 &&
fdata->max_height > h) ? h :
fdata->max_height;
810 fdata->style[0] =
'\0';
815 fdata->style[127] =
'\0';
818 if(storage->initialize_store)
822 format->set_params(format,
fdata, format->params_size(format));
823 storage->set_params(storage, sdata, storage->params_size(storage));
828 int num = 1,
res = 0;
836 if(storage->store(storage, sdata,
id, format,
fdata, num, total,
TRUE, export_masks,
837 icc_type, icc_filename, icc_intent, &metadata) != 0)
842 if(storage->finalize_store) storage->finalize_store(storage, sdata);
843 storage->free_params(storage, sdata);
844 format->free_params(format,
fdata);
static void usage(const char *progname)
static dt_iop_color_intent_t get_icc_intent(const char *option)
#define DT_MAX_OUTPUT_EXT_LENGTH
#define ICC_INTENT_FROM_STR(name)
static dt_colorspaces_color_profile_type_t get_icc_type(const char *option)
#define DT_MAX_STYLE_NAME_LENGTH
#define ICC_FROM_STR(name)
static void icc_intents()
static dt_aligned_pixel_t XYZ
int32_t dt_image_import(const int32_t film_id, const char *filename, gboolean raise_signals)
const char darktable_package_version[]
const char darktable_last_commit_year[]
int dt_init(int argc, char *argv[], const gboolean init_gui, const gboolean load_data)
void dt_loc_get_localedir(char *localedir, size_t bufsize)
void dt_loc_init(const char *datadir, const char *moduledir, const char *localedir, const char *configdir, const char *cachedir, const char *tmpdir, const char *kerneldir)
int dt_film_new(dt_film_t *film, const char *directory)
GList * dt_film_get_image_ids(const int filmid)
int dt_film_import(const char *dirname)
char * dt_history_get_items_as_string(const int32_t imgid)
void dt_image_cache_write_release(dt_image_t *img, dt_image_cache_write_mode_t mode)
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
void dt_image_cache_read_release(const dt_image_t *img)
dt_imageio_module_format_t * dt_imageio_get_format_by_name(const char *name)
dt_imageio_module_storage_t * dt_imageio_get_storage_by_name(const char *name)
void dt_l10n_disable_setlocale_early(void)
float *const restrict const size_t k
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
static void dt_free_gpointer(gpointer ptr)
void dt_osx_prepare_environment()
#define DT_MAX_PATH_FOR_PARAMS
dt_iop_color_intent_t
ICC rendering intent, as stored in iop params and in conf.
@ DT_INTENT_LAST
Count of real intents, and the codebase's "unset" marker – never a user choice.
dt_colorspaces_color_profile_type_t
@ DT_COLORSPACE_NONE
No profile / "take it from the image settings". Never matches a list entry.
@ DT_COLORSPACE_LAST
Count, not a colour space. The last usable value is DT_COLORSPACE_LAST - 1.
int dt_exif_xmp_read(dt_image_t *img, const char *filename, const int history_only)
The XMP document that carries an image's development: history stack, mask shapes, module order,...