An electronic device comprising: a memory storing one or more instructions; and a processor configured to execute the one or more instructions to: receive a selection of a location of a synthesis region in an input image, detect, by using one or more neural networks, at least one object different from a background by extracting features from the input image, classify categories of the detected one or more objects, and obtain location information of the detected objects; characterized in that the processor is further configured to: obtain, by using one or more neural networks, a target object image to be located in the synthesis region of the input image, based on information on the at least one object detected in the input image comprising object class of the at least one object and distance information indicating a distance from the location of the synthesis region to a location of the at least one object detected in the input image, generate, by using the one or more neural networks, a composite image by combining the input image with the target object image, and control a display of the electronic device to display the composite image. a memory storing one or more instructions; and a processor configured to execute the one or more instructions to: receive a selection of a location of a synthesis region in an input image, detect, by using one or more neural networks, at least one object different from a background by extracting features from the input image, classify categories of the detected one or more objects, and obtain location information of the detected objects; characterized in that the processor is further configured to: obtain, by using one or more neural networks, a target object image to be located in the synthesis region of the input image, based on information on the at least one object detected in the input image comprising object class of the at least one object and distance information indicating a distance from the location of the synthesis region to a location of the at least one object detected in the input image, generate, by using the one or more neural networks, a composite image by combining the input image with the target object image, and control a display of the electronic device to display the composite image. receive a selection of a location of a synthesis region in an input image, detect, by using one or more neural networks, at least one object different from a background by extracting features from the input image, classify categories of the detected one or more objects, and obtain location information of the detected objects; characterized in that the processor is further configured to: obtain, by using one or more neural networks, a target object image to be located in the synthesis region of the input image, based on information on the at least one object detected in the input image comprising object class of the at least one object and distance information indicating a distance from the location of the synthesis region to a location of the at least one object detected in the input image, generate, by using the one or more neural networks, a composite image by combining the input image with the target object image, and control a display of the electronic device to display the composite image. obtain, by using one or more neural networks, a target object image to be located in the synthesis region of the input image, based on information on the at least one object detected in the input image comprising object class of the at least one object and distance information indicating a distance from the location of the synthesis region to a location of the at least one object detected in the input image, generate, by using the one or more neural networks, a composite image by combining the input image with the target object image, and control a display of the electronic device to display the composite image.