diff --git a/src/grdimage.c b/src/grdimage.c index fbb587813c2..bd668f53992 100644 --- a/src/grdimage.c +++ b/src/grdimage.c @@ -1970,7 +1970,7 @@ tr_image: GMT_Report (API, GMT_MSG_INFORMATION, "Project the input image\n"); gmt_set_grddim (GMT, Img_proj->header); /* Recalculate projected image dimensions */ if (GMT_Create_Data (API, GMT_IS_IMAGE, GMT_IS_SURFACE, GMT_DATA_ONLY, NULL, NULL, NULL, 0, 0, Img_proj) == NULL) Return (API->error); /* Failed to allocate memory for the projected image */ - if (gmt_img_project (GMT, I, Img_proj, false)) Return (GMT_RUNTIME_ERROR); /* Now project the image onto the projected rectangle */ + if (need_to_project && gmt_img_project (GMT, I, Img_proj, false)) Return (GMT_RUNTIME_ERROR); /* Now project the image onto the projected rectangle */ if (!API->external && (GMT_Destroy_Data (API, &I) != GMT_NOERROR)) { /* Free the original image now we have projected. Use Img_proj from now on */ Return (API->error); /* Failed to free the image */ }