def browse_picture(self):
self.image = QtGui.QFileDialog.getOpenFileName(None,'OpenFile','c:\\',"Image file(*.png *.jpg)")
self.progressBar.setValue(0)
self.image = str(self.image)
print(self.image)
self.file_name = ntpath.basename(self.image)
self.file_name, ext=os.path.splitext(self.file_name)
self.file_path = ntpath.dirname(self.image)
self.write_path = ntpath.expanduser('~\\Documents\\Document Analysis')
# creating write path if not exists
if not os.path.exists(self.write_path):
os.makedirs(self.write_path)
if self.image:
pixmap = QtGui.QPixmap(self.image)
pixmap = pixmap.scaled(pixmap.width()/5, pixmap.height()/5, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
#self.labelInputImage.resize(pixmap.width()/4,pixmap.height()/4)
#self.labelInputImage.setPixmap(QtGui.QPixmap(self.image).
# scaled(self.labelInputImage.width(),
# self.labelInputImage.height()))
self.labelInputImage.setPixmap(pixmap)
#self.btnImageBrowse.setEnabled(False)
评论列表
文章目录