In this article, a new method for rapid tool movement in CNC machines is presented. Firstly, a single digital camera, installed on the Z-axis, captures the image of the workpiece on the work table. Image processing techniques, implemented using MATLAB, are then used to convert the image into a binary black and white image. This allows the locations of protruding edge sections on the workpiece, which could impede tool movement, to be identified. Quadtree decomposition is then performed on the binary image, and possible paths from the tool current location to its target location are found. These paths are then analysed based on the tool diameter clearance and the distance to the goal, and the shortest path with sufficient tool clearance is selected. A Visual Basic program then converts the selected path into G-code commands that provides instructions to the CNC machine tool such that this path is followed. With this method, the workpiece fixture location would not have to be precise as the imaging system would be able to automatically identify the target location with respect to the tool current location, along with the optimal path to reach it.