The demand for uniform electric fields (UEFs) in engineering is very high, particularly in high-voltage devices. The existing methods encounter limitations in terms of optimization region and universality. Herein, we propose a method for designing UEFs based on finite element calculations of electromagnetic fields and machine learning. First, the electric-field distribution of the plate-to-plate electrode structure determined using three electrode-shape parameters (ESPs) is calculated using finite element software and is drawn. Thereafter, a dataset of 2000 images is created with different electric-field strength distributions using various ESPs. Net, we employ image-processing techniques to extract nine statistical features from the gray-level information in the images. Models are trained through machine learning to predict ESPs based on the gray-level features (GLFs). Finally, the electric-field strength distribution image of the expected ideal uniform field is artificially selected. In addition, the ESPs from which the uniform electric-field is produced are predicted by the models. The proposed method provides an accurate solution for optimizing the design of a uniform electric-field and a new approach for solving inverse problems of electric-field. This involves drawing the required electric-field strength distribution image for high-voltage engineering and obtaining the required ESPs.