Skip to content

Commit

Permalink
fix dpi param for svg and pdf #203 (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
JMontupet authored Mar 9, 2022
1 parent 9984c53 commit 19c388d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vips/foreign.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ int load_image_buffer(LoadParams *params, void *buf, size_t len,
vips_object_set(VIPS_OBJECT(OP), NAME, PARAM.value.i, NULL); \
}

#define MAYBE_SET_DOUBLE(OP, PARAM, NAME) \
if (PARAM.is_set) { \
vips_object_set(VIPS_OBJECT(OP), NAME, PARAM.value.d, NULL); \
}

typedef int (*SetLoadOptionsFn)(VipsOperation *operation, LoadParams *params);

int set_jpegload_options(VipsOperation *operation, LoadParams *params) {
Expand Down Expand Up @@ -125,13 +130,13 @@ int set_gifload_options(VipsOperation *operation, LoadParams *params) {
int set_pdfload_options(VipsOperation *operation, LoadParams *params) {
MAYBE_SET_INT(operation, params->page, "page");
MAYBE_SET_INT(operation, params->n, "n");
MAYBE_SET_INT(operation, params->dpi, "dpi");
MAYBE_SET_DOUBLE(operation, params->dpi, "dpi");
return 0;
}

int set_svgload_options(VipsOperation *operation, LoadParams *params) {
MAYBE_SET_BOOL(operation, params->svgUnlimited, "unlimited");
MAYBE_SET_INT(operation, params->dpi, "dpi");
MAYBE_SET_DOUBLE(operation, params->dpi, "dpi");
return 0;
}

Expand Down

0 comments on commit 19c388d

Please sign in to comment.