A device for detecting the spectrum of electromagnetic radiation within a specified wavelength range, comprising - a substrate, - a first aperture mask arranged above the substrate and made of a material being non-transmissive to radiation within the specified wavelength range, the first aperture mask comprising a plurality of first windows, - a plurality of sensor elements arranged in the substrate and being sensitive to radiation of respectively a different wavelength within the specified wavelength range, and - a second aperture mask arranged above the first aperture mask and comprising second windows, said second aperture mask being made of a material being non-transmissive to the radiation within the specified wavelength range, - wherein the second windows of the second aperture mask are arranged to overlap with the windows of the first aperture mask, and wherein opposite edges of the respective two overlapping windows (22,36) of the two aperture masks (20,32) define the size of a radiation passage assigned to a respective sensor element and designed for allowing radiation of a wavelength within the specified wavelength range to pass to the sensor element arranged below the radiation passage, - wherein, for detecting the intensity of electromagnetic radiation at each of the plurality of wavelengths of interest within the specified wavelength range, at least one of the radiation passages is provided, having a size assigned to one of the respective wavelengths of interest, and - wherein the windows of the first aperture mask have a first distance and the windows of the second aperture mask have a second distance, characterized in that the first distance and the second distance are different from each other so that the degree of overlap of adjacent windows of the two aperture masks is varying and the radiation passages thus have different sizes. - a substrate, - a first aperture mask arranged above the substrate and made of a material being non-transmissive to radiation within the specified wavelength range, the first aperture mask comprising a plurality of first windows, - a plurality of sensor elements arranged in the substrate and being sensitive to radiation of respectively a different wavelength within the specified wavelength range, and - a second aperture mask arranged above the first aperture mask and comprising second windows, said second aperture mask being made of a material being non-transmissive to the radiation within the specified wavelength range, - wherein the second windows of the second aperture mask are arranged to overlap with the windows of the first aperture mask, and wherein opposite edges of the respective two overlapping windows (22,36) of the two aperture masks (20,32) define the size of a radiation passage assigned to a respective sensor element and designed for allowing radiation of a wavelength within the specified wavelength range to pass to the sensor element arranged below the radiation passage, - wherein, for detecting the intensity of electromagnetic radiation at each of the plurality of wavelengths of interest within the specified wavelength range, at least one of the radiation passages is provided, having a size assigned to one of the respective wavelengths of interest, and - wherein the windows of the first aperture mask have a first distance and the windows of the second aperture mask have a second distance,