A method for producing a multipixel detector, the method comprising: providing a bottom layer comprising a first and a second bottom electrode; depositing an electrically insulating layer on the bottom layer; forming a first opening through the electrically insulating layer to the first bottom electrode; depositing a first photon absorbing material in the first opening to electrically connect to the first bottom electrode; forming a second opening through the electrically insulating layer to the second bottom electrode; depositing a second photon absorbing material in the second opening to electrically connect to the second bottom electrode; planarizing the deposited electrically insulating layer, the deposited first photon absorbing material and the deposited second photon absorbing material to form a flat surface, wherein the flat surface comprises a top surface of the electrically insulating layer, a top surface of the first photon absorbing material in the first opening and a top surface of the second photon absorbing material in the second opening, separated from the top surface of the first photon absorbing material by the top surface of the electrically insulating layer; forming a common top electrode on top of the flat surface, wherein the common top electrode electrically connects to the top surfaces (51, 52) of the first and second photon absorbing materials in the flat surface; wherein the common top electrode, the first photon absorbing material in the first opening and the first bottom electrode form parts of a first thin film photodiode, first TFPD,; and the common top electrode, the second photon absorbing material in the second opening and the second bottom electrode form parts of a second thin film photodiode, second TFPD,. providing a bottom layer comprising a first and a second bottom electrode; depositing an electrically insulating layer on the bottom layer; forming a first opening through the electrically insulating layer to the first bottom electrode; depositing a first photon absorbing material in the first opening to electrically connect to the first bottom electrode; forming a second opening through the electrically insulating layer to the second bottom electrode; depositing a second photon absorbing material in the second opening to electrically connect to the second bottom electrode; planarizing the deposited electrically insulating layer, the deposited first photon absorbing material and the deposited second photon absorbing material to form a flat surface, wherein the flat surface comprises a top surface of the electrically insulating layer, a top surface of the first photon absorbing material in the first opening and a top surface of the second photon absorbing material in the second opening, separated from the top surface of the first photon absorbing material by the top surface of the electrically insulating layer; forming a common top electrode on top of the flat surface, wherein the common top electrode electrically connects to the top surfaces (51, 52) of the first and second photon absorbing materials in the flat surface; wherein the common top electrode, the first photon absorbing material in the first opening and the first bottom electrode form parts of a first thin film photodiode, first TFPD,; and the common top electrode, the second photon absorbing material in the second opening and the second bottom electrode form parts of a second thin film photodiode, second TFPD,.