Image rename tool with tags and image preview

Sorry, this is only sort of Blender related (I’d rename images made with Blender with this) - But this is all about Python for sure.

My plan is to have this made in Python3 and PyQt5:

I followed this tutorial and got the UI made, but these features I’m unable to make with my skills :confused:

  • Creator’s name should be inserted to the New Filename (like in the picture)
  • The checkbox tags should be inserted to the New Filename (like in the picture)
  • The checkbox tags should clear when you press ‘Rename’
  • One should be able to create new tags with the ‘Add tag’ button
  • One should be able to load in bunch of image files and flick through them with the ‘Previous Image’ and ‘Next Image’ buttons
  • The current image in the list should be displayed in the Image box

I think this would be a great resource of code for someone who searches how something like this could be made.

Here is some help on how to insert those new checkboxes.

And here’s all the code made so far. The views.py seems to be the most important file for what I’m asking: .zip package of python files and some example image files to be renamed.

I really hope someone would like to help with this, that would be appreciated a lot :slight_smile:

Cheers!

Manu

Hi Manu!

Just a quick solution to get you started with dislaying the image: In QT Creator add a QLabel inside the imageFrame and name it imageLabel. Then in view.py add self.displayImage() to the end of loadFiles() (inside the if block) and add the following method:

def displayImage(self):
    imageFilename = os.path.join(self.sourceDirectory.text(), self.currentFileName.text())
    self.imageLabel.setPixmap(QtGui.QPixmap(imageFilename))

I’m still trying to find out how to fit and resize the image in that label while keeping the aspect ratio, but this looks like a good start :slight_smile:

EDIT:

Make that

def displayImage(self):
    imageFilename = os.path.join(self.sourceDirectory.text(), self.currentFileName.text())
    w = self.imageLabel.width()
    h = self.imageLabel.height()
    self.imageLabel.setPixmap(QtGui.QPixmap(imageFilename).scaled(w, h, QtCore.Qt.KeepAspectRatio))

and maybe set the SizePolicy in QT Creator to Maximum/Maximum.

BTW: Can you set up a repository over at github? I think that would make these things a lot easier

Haha, would’ve saved me an allnighter if I had this info earlier :slight_smile: I kinda googled those same aspects over time. Thank you very much for the input, though!

At the moment the tool works like this

Aaand finally the Image Renaming Tool is done! Thanks to all who helped! Made in Python3 and PyQt5

Presentation video in YouTube

Source Code

Linux, Windows and Mac standalone executables are coming once I get them done with PyInstaller. They can be eventually found in MyMaterial.org

Cheers everyone!
Manu

1 Like