Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/control/jobs/control_jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ typedef struct dt_control_export_t
// resets things like overwrite
// once the export
// is dispatched, but we have to keep that information
gboolean high_quality, upscale, export_masks;
gboolean high_quality, upscale, export_masks, is_scaling;
double scale_factor;
char style[128];
gboolean style_append;
dt_colorspaces_color_profile_type_t icc_type;
Expand Down Expand Up @@ -1884,14 +1885,6 @@ static int32_t _control_export_job_run(dt_job_t *job)
"\x1b%G"); // ESC % G
}

// scaling
const gboolean is_scaling =
dt_conf_is_equal("plugins/lighttable/export/resizing", "scaling");

double _num, _denum;
dt_imageio_resizing_factor_get_and_parsing(&_num, &_denum);
const double scale_factor = is_scaling? _num / _denum : 1.0;

dt_export_metadata_t metadata;
metadata.flags = 0;
metadata.list = dt_util_str_to_glist("\1", settings->metadata_export);
Expand Down Expand Up @@ -1934,7 +1927,7 @@ static int32_t _control_export_job_run(dt_job_t *job)
dt_image_cache_read_release(image);
if(mstorage->store(mstorage, sdata, imgid, mformat, fdata,
num, total, settings->high_quality, settings->upscale,
is_scaling, scale_factor,
settings->is_scaling, settings->scale_factor,
settings->export_masks, settings->icc_type,
settings->icc_filename, settings->icc_intent,
&metadata) != 0)
Expand Down Expand Up @@ -2533,6 +2526,8 @@ void dt_control_export(GList *imgid_list,
const gboolean high_quality,
const gboolean upscale,
const gboolean dimensions_scale,
const gboolean is_scaling,
const double scale_factor,
const gboolean export_masks,
char *style,
const gboolean style_append,
Expand Down Expand Up @@ -2574,6 +2569,8 @@ void dt_control_export(GList *imgid_list,
data->export_masks = export_masks;
data->upscale = ((max_width == 0 && max_height == 0)
&& !dimensions_scale) ? FALSE : upscale;
data->is_scaling = is_scaling;
data->scale_factor = scale_factor;
g_strlcpy(data->style, style, sizeof(data->style));
data->style_append = style_append;
data->icc_type = icc_type;
Expand Down
2 changes: 2 additions & 0 deletions src/control/jobs/control_jobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ void dt_control_export(GList *imgid_list,
const gboolean high_quality,
const gboolean upscale,
const gboolean dimensions_scale,
const gboolean is_scaling,
const double scale_factor,
const gboolean export_masks,
char *style,
const gboolean style_append,
Expand Down
13 changes: 11 additions & 2 deletions src/libs/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,14 @@ static void _export_with_current_settings(dt_lib_module_t *self)
g_strlcpy(style, tmp, sizeof(style));
}

// scaling
const gboolean is_scaling =
dt_conf_is_equal("plugins/lighttable/export/resizing", "scaling");

double _num, _denum;
dt_imageio_resizing_factor_get_and_parsing(&_num, &_denum);
const double scale_factor = is_scaling? _num / _denum : 1.0;

// if upscale is activated and only one dimension is 0 we adjust it to ensure
// that the up-scaling will happen. The null dimension is set to MAX_ASPECT_RATIO
// time the other dimension, allowing for a ratio of max 1:100 exported images.
Expand All @@ -406,8 +414,9 @@ static void _export_with_current_settings(dt_lib_module_t *self)

GList *list = dt_act_on_get_images(TRUE, TRUE, TRUE);
dt_control_export(list, max_width, max_height, format_index, storage_index,
high_quality, upscale, scaledimension, export_masks,
style, style_append,
high_quality, upscale, scaledimension,
is_scaling, scale_factor,
export_masks, style, style_append,
icc_type, icc_filename, icc_intent,
d->metadata_export);

Expand Down
Loading