diff --git a/NanScan/Barcode.py b/NanScan/Barcode.py index 851894c..ef8f162 100644 --- a/NanScan/Barcode.py +++ b/NanScan/Barcode.py @@ -81,7 +81,9 @@ class Barcode(Analyzer): self.dotsPerMillimeterY = float( image.dotsPerMeterY() ) / 1000.0 file = TemporaryFile.create() - image.save( file, 'PNG' ) + # Use BMP format instead of PNG, for performance reasons. + # BMP takes about 0.5 seconds whereas PNG takes 13. + image.save( file, 'BMP' ) command = '/home/albert/d/git/exact-image-0.5.0/objdir/frontends/bardecode' content = self.spawn( command, file ) self.parseBardecodeOutput( content ) diff --git a/NanScan/DataMatrix.py b/NanScan/DataMatrix.py index 258f45c..7c5a53f 100644 --- a/NanScan/DataMatrix.py +++ b/NanScan/DataMatrix.py @@ -132,7 +132,9 @@ class DataMatrix(Analyzer): self.dotsPerMillimeterY = float( image.dotsPerMeterY() ) / 1000.0 file = TemporaryFile.create() - image.save( file, 'PNG' ) + # Use BMP format instead of PNG, for performance reasons. + # BMP takes about 0.5 seconds whereas PNG takes 13. + image.save( file, 'BMP' ) command = 'dmtxread' content = self.spawn( command, '-n', '-v', file ) self.parseOutput( content ) diff --git a/NanScan/Ocr.py b/NanScan/Ocr.py index d2efce4..a734b8e 100755 --- a/NanScan/Ocr.py +++ b/NanScan/Ocr.py @@ -167,7 +167,9 @@ class Ocr(Analyzer): #self.boxes = self.parseTesseractOutput(txt) # Cuneiform Steps - self.file = TemporaryFile.create( '.png' ) + # Use BMP format instead of PNG, for performance reasons. + # BMP takes about 0.5 seconds whereas PNG takes 13. + self.file = TemporaryFile.create( '.bmp' ) image.save( self.file ) txt = lower( self.cuneiform() ) self.boxes = self.parseCuneiformOutput(txt)