Discussion Forums > Technology

Danbooru Image tagger/renamer << NEED HELP!!!

<< < (2/9) > >>

Xiong Chiamiov:
A few months ago I hacked up a script to assign metadata to images based on their tags on Sankaku Complex's imageboard.  It's not a particularly clean design, but it works enough for me (which is why I haven't done anything more to it since then).  I've never run it on Windows, but I don't believe anything about it is OS-specific.

Once I started using a photo organizer that can filter by tags, I gave up browsing photos by folders entirely.  It's really quite a bit better.  If you want to move files around, though, that's easily done.

If you want to use it, you'll need to change the urls to point to your image board of choice.  You'll probably want to change the actual tags that get written, too, unless you're using Digikam.  See the comments on starting on line 44.  If you're not familiar with Python, I can make the desired modifications for you.

I've been pondering a photo organizer that is specifically designed for dealing with imageboards; if you're interested in this, let me know, and it might get pushed up my (rather long) priority queue.

Kyrdua:
^ hmm, never knew you had such project, might just be the thing i'm looking for.


I have picasa(windows)  ATM, will that do?
i don't quite get this dublin core thing though. i did a google but i don't think i got it yet.
so from what i gather here, this python script gets the tags from the booru i point it to, and exports it to a file(kinda like sfv or a database of sorts, i guess) containing the path/filenames of my images and their tags.
and from there, i can use stuff that can rename files based on a text/database/whatever file to sort/rename my images, is that right?


I think i can modify the script myself, i'll just post what i did in case it doesn't work, i also don't know how to run python scripts in windows since the last time i used python was on linux.
damn, wish PS CS3 and word 2007 worked perfectly in linux so i didn't have to switch back to win >_<.


and i think a photo organizer for imageboards is a great idea, definitely would be great if you'll make one.

Xiong Chiamiov:

--- Quote from: Kyrdua on February 04, 2011, 12:56:53 AM ---I have picasa(windows)  ATM, will that do?

--- End quote ---
Depends on your needs.

Tags are shown underneath pictures, if available.
(click to show/hide)
You need to enable that as the thumbnail caption, though.
(click to show/hide)
You can filter images by tag, and tags are auto-completed.  There doesn't seem to be a list of all tags, though.
(click to show/hide)
To compare, this is what Digikam's main window looks like (with the folder/etc. views on the left collapsed):
(click to show/hide)As you can see, I can do some moderately complicated filtering of tags (either AND or OR them all together).  Personally, I'd like nested boolean expressions, but I'm rather demanding of my applications.


--- Quote ---i don't quite get this dublin core thing though. i did a google but i don't think i got it yet.
so from what i gather here, this python script gets the tags from the booru i point it to, and exports it to a file(kinda like sfv or a database of sorts, i guess) containing the path/filenames of my images and their tags.
and from there, i can use stuff that can rename files based on a text/database/whatever file to sort/rename my images, is that right?

--- End quote ---
Not quite.  The tags that I was talking about are a form of metadata, which is information about a file contained in the file itself (ok, not strictly, but for this purpose).  The most common example is ID3 tags in your mp3s.  So, rather than having an artist associated with a piece of music, you have a series of descriptive "tags" associated with an image.

Unfortunately, there are a number of different formats for image metadata.  EXIF is one of the more common ones, and what sheska writes.  IPTC and XMP are the other common ones that I know of.

Even once we decide on a format to use for the metadata, we still have to decide on what to call the various fields.  Dublin Core is a small set of standard fields that are recognized by pretty much everything.  Most applications define additional fields in their own schema for any more specific needs.  Digikam has one called 'TagsList', which I used over the generic 'Subject' for reasons that aren't important here.

So, since Picasa doesn't recognize Digikam's 'TagsList', just change that part of the code to 'Subject' instead.

One thing to be aware of is that EXIF doesn't support PNGs or GIFs.


--- Quote ---I think i can modify the script myself, i'll just post what i did in case it doesn't work, i also don't know how to run python scripts in windows since the last time i used python was on linux.

--- End quote ---
Just download Python (2.7, not 3.1) from python.org and install it, then run the script the same way you would in Linux (python sheska.py file1 file2 file3...).


--- Quote ---and i think a photo organizer for imageboards is a great idea, definitely would be great if you'll make one.

--- End quote ---
I'll post here if I start working on it.

Kyrdua:
^ hmm, i can live with that. i'll just post if it works or a problem comes up.

Kyrdua:
<bump, pls merge>

OTL that's it, i give up, here's the command line error message

(click to show/hide)
--- Code: ---
Processing 7ef45df1d0bf63e4525780fa54c2fb56.jpg
Checking for original hash...
Traceback (most recent call last):
  File "sheska.py", line 61, in <module>
    image = File(filename)
  File "sheska.py", line 17, in __init__
    unparsedTagLine = self.call('-xmp:md5sum')
  File "sheska.py", line 41, in <lambda>
    call = lambda self, arg: Popen(['exiftool', '-overwrite_original', arg, self
.filename], stdout=PIPE).communicate()[0]
  File "C:\Python27\lib\subprocess.py", line 672, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 882, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
--- End code ---

here's the edited py file i'm using.

here are the file locations(dublincore included)

--- Code: ---
C:\Documents and Settings\<USER>\My Documents\Downloads\dublincore-1.0\dublincore.py
C:\Documents and Settings\<USER>\My Documents\Downloads\dublincore-1.0\dublincore-meta.rdf
C:\Documents and Settings\<USER>\My Documents\Downloads\dublincore-1.0\PKG-INFO
C:\Documents and Settings\<USER>\My Documents\Downloads\dublincore-1.0\setup.py

C:\Documents and Settings\<USER>\My Documents\Downloads\sheska.py
C:\Documents and Settings\<USER>\My Documents\Downloads\<hash>.jpg
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version