1. A computer-implemented method for generating a modified image, the method comprising: initiating, in a computer device, a patch-based optimization algorithm for using a first image to generate a second image; identifying, in a computer device, a first feature of a first image, the identification corresponding to a constraint on the first feature for generating a second image, the constraint restricting at least one of location and geometric orientation in the second image of patches representing the first feature; identifying, using the computer device, contents for the second image by processing patches in the image in iterations of the patch-based optimization algorithm, the patch-based optimization complying with the constraint; and generating the second image from the identified contents based on the iterations of the patch-based optimization algorithm, the second image including a second feature generated to represent the first feature and complying with the constraint; wherein the first feature is defined by a parametric-equation line, and wherein the constraint generates a parametric equation that defines the second feature.