Computer-implemented method for reconstructing a barcode, wherein for a received digital input image with a barcode, a bar of the barcode with a gap, the gap represented and defined by an interrupted or broken portion of the bar, is identified, and the gap is reconstructed pixelwise by setting all gap pixels of the bar with the gap to a value representing the identified bar as a numeric value of an index in a grey scale, and a reconstructed digital output image provided, wherein following steps are executed: a) receiving a digital input image with a barcode, b) detecting a rectangular candidate area within the received image, wherein the area includes the barcode and the bars of the barcode are perpendicularly arranged elongated along the longer side of the rectangular candidate area, c) calculating a virtual sampling line for the candidate area, which is parallel to a longer side of the rectangular candidate area, d) defining a sampling point on the virtual sampling line, e) calculating a virtual bar line for the candidate area perpendicular to the virtual sampling line crossing the sampling point, f) identifying bar pixels within the candidate area being on the virtual bar line, g) calculating an average field index for each of the bar pixels representing the average pixel value, representing a numeric value of an index in a grey scale, of the pixels of the candidate area within a predefined distance around the respective pixel, h) detecting significant pixels from all the bar pixels, which respective pixel value is smaller than the respective average field index, i) counting significant pixels and if the count is greater than a predefined confidence ratio, define all pixels along the virtual bar line as proper pixels, j) reconstructing pixels by setting the proper pixels to the value of a respective pixel of a bar pixel in the image, k) selecting a new position of the sampling point on the virtual sampling line, which is not yet processed, l) continuing with step e), until all positions of the sampling point are being processed, m) provide the reconstructed digital image as a digital output image. a) receiving a digital input image with a barcode, b) detecting a rectangular candidate area within the received image, wherein the area includes the barcode and the bars of the barcode are perpendicularly arranged elongated along the longer side of the rectangular candidate area, c) calculating a virtual sampling line for the candidate area, which is parallel to a longer side of the rectangular candidate area, d) defining a sampling point on the virtual sampling line, e) calculating a virtual bar line for the candidate area perpendicular to the virtual sampling line crossing the sampling point, f) identifying bar pixels within the candidate area being on the virtual bar line, g) calculating an average field index for each of the bar pixels representing the average pixel value, representing a numeric value of an index in a grey scale, of the pixels of the candidate area within a predefined distance around the respective pixel, h) detecting significant pixels from all the bar pixels, which respective pixel value is smaller than the respective average field index, i) counting significant pixels and if the count is greater than a predefined confidence ratio, define all pixels along the virtual bar line as proper pixels, j) reconstructing pixels by setting the proper pixels to the value of a respective pixel of a bar pixel in the image, k) selecting a new position of the sampling point on the virtual sampling line, which is not yet processed, l) continuing with step e), until all positions of the sampling point are being processed, m) provide the reconstructed digital image as a digital output image.