Patent ID: 8903536

Claim:
An apparatus comprising: a processor; and a memory configured to store computer-readable instructions, wherein the computer-readable instructions cause the processor to perform processes comprising: arranging, based on image data of an image that is an aggregate of a plurality of pixels, a plurality of line segments in an area corresponding to the image, the plurality of line segments each having two endpoints, which are a starting point and an ending point; sequentially connecting the arranged plurality of line segments; and creating, as embroidery data, data for stitches that correspond to the connected plurality of line segments, wherein the sequentially connecting the plurality of line segments includes, until all the plurality of line segments are connected, repeating processes comprising: identifying, as a first line segment, a line segment having an ending point that is not connected to another line segment, from among the plurality of line segments; calculating a distance between the ending point of the first line segment and a starting point of at least one second line segment, both of two endpoints of the at least one second line segment being not connected to another line segment, and the starting point of the at least one second line segment being an endpoint that is closer to the ending point of the first line segment, among the two endpoints of the at least one second line segment; calculating an angle difference between a first angle and a second angle, the first angle being an angle of the first line segment with respect to a reference line, and the second angle being an angle of the at least one second line segment with respect to the reference line; identifying a third angle, the third angle being an angle formed by the first line segment and a third line segment, the third line segment being a line segment connecting the ending point of the first line segment and the starting point of the at least one second line segment; and connecting to the ending point of the first line segment, in accordance with a priority order, a starting point of the second line segment for which a priority corresponding to a combination of a distance range to which the distance belongs, an angle difference range to which the angle difference belongs, and an angle range to which the third angle belongs is highest among the at least one second line segments, the priority order being set in advance for a plurality of combinations in which one of a plurality of distance ranges, one of a plurality of angle difference ranges, and one of a plurality of angle ranges are combined.