This document presents a novel algorithm for detecting papilledema in retinal images using luminosity and contrast enhancement. The algorithm first enhances poor quality retinal images by applying gamma correction to increase luminosity and contrast limited adaptive histogram equalization (CLAHE) to boost contrast. It then uses particle swarm optimization to locate the optic disc, which is the brightest region in the retina. By measuring the size of the located optic disc and comparing it to a threshold, the algorithm can detect if papilledema, which is swelling of the optic disc, is present. If the optic disc size is above the threshold, papilledema is detected.