We studied the geometrical factors controlling the magnitude of the demagnetizing field and the fringing fields of ferromagnetic thin films with perpendicular, out-of-plane magnetization. The magnetic field emerging from the patterned ferromagnetic thin film can interact with carriers in an underlying semiconductor structure and generate a Hall voltage. Different geometries for use in practical device applications have been analyzed, using a simplified model as a design tool. The optimum geometry of the ferromagnetic thin film that will give maximum magnetic-field strength in the underlying semiconductor consists of a grating-type structure with periodicity of a few 100 nm to 1 mum. These geometries are suited for realization by holographic lithography.