summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gen-image.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/gen-image.c b/src/gen-image.c
index d9f9225..170d694 100644
--- a/src/gen-image.c
+++ b/src/gen-image.c
@@ -1531,6 +1531,23 @@ static int process(const struct options *options)
goto done;
}
+ /* Crop */
+ if (options->crop) {
+ struct image *cropped;
+
+ cropped = image_new(format_by_name("RGB24"),
+ options->inputcrop.width,
+ options->inputcrop.height);
+ if (!cropped) {
+ ret = -ENOMEM;
+ goto done;
+ }
+
+ image_crop(input, cropped, &options->inputcrop);
+ image_delete(input);
+ input = cropped;
+ }
+
/* Convert colorspace */
if (options->input_format->type == FORMAT_YUV) {
struct image *yuv;
@@ -1561,22 +1578,6 @@ static int process(const struct options *options)
input = rgb;
}
- /* Crop */
- if (options->crop) {
- struct image *cropped;
-
- cropped = image_new(input->format, options->inputcrop.width,
- options->inputcrop.height);
- if (!cropped) {
- ret = -ENOMEM;
- goto done;
- }
-
- image_crop(input, cropped, &options->inputcrop);
- image_delete(input);
- input = cropped;
- }
-
/* Scale */
if (options->output_width && options->output_height) {
output_width = options->output_width;