Author Topic: <-- Archived --> (Image Tagger 0.3 released!)  (Read 9903 times)

0 Members and 1 Guest are viewing this topic.

Offline rudistoned

  • Full Member
  • ***
  • Posts: 229
<-- Archived --> (Image Tagger 0.3 released!)
« on: August 04, 2013, 02:03:43 AM »
Image Tagger


Image Tagger allows users to embed keywords, called tags, into their images. Later on, these tags can be used in other applications that work with the tagged images. The embedded tags are stored in form of XMP metadata in the image files.


for more information and download links, please see the release thread in the Otherworld forum: release thread
« Last Edit: April 24, 2016, 07:01:35 AM by Xela »

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6881
  • "It's like hunting cows"
Re: Image Tagger 0.1 Release Candidate 1
« Reply #1 on: August 04, 2013, 02:10:20 AM »
Great job :)

Shouldn't this be in the Game Design section???

Also, this just tags the images, right? It doesn't create JSON files or pickled objects that we can load into the game?
Like what we're doing?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6881
  • "It's like hunting cows"
Re: Image Tagger 0.1 Release Candidate 1
« Reply #2 on: August 04, 2013, 02:24:43 AM »
I cannot see the images? I seem to be following the instructions and pick the folder, getting the amount of images that can be tagged with listing (next/previous and so on) but I cannot see the actual image (assuming it is suppose to appear in the middle area).

Using Windows version btw.
Like what we're doing?

Offline rudistoned

  • Full Member
  • ***
  • Posts: 229
Re: Image Tagger 0.1 Release Candidate 1
« Reply #3 on: August 04, 2013, 02:28:48 AM »
Hey guys :-)


Maybe some of you wondered were I disappeared too? Well, I felt like working on my own projects, so I did. Over the last month, I rewrote Image Tagger and Pytherworld to get rid of design errors I made when I knew a lot less about the MVC design paradigm, event-driven applications and Qt. I went surprisingly well and fast.


Here's how PyTFall can benefit from my efforts:


1) Image Tagger
This is my image tagging software. You can use it to add as many tags as you like to any JPEG or PNG image. These tags are embedded as XMP metadata within the image. To retrieve this metadata with another Python program, e.g. PyTFall, see 2).


Regarding the warning:
ImageTagger is unit tested and tested manually too on both Windows and Linux. I also never had image file corruptions using Image Tagger. However, apart from my own tests, you are the first to try this new version of Image Tagger, so please, take the warning seriously! Create backups of your images before you start tagging!


2) The tags package
This package allows your application to retrieve tags stored as XMP metadata from JPEGs and PNGs. It has other things to offer too, just take a look at the docstrings of its classes (for example, open a python interpreter, import the tags package and type help(tags)).


Quick how to:
*)Add this code to your program
Code: [Select]
import tags
tags.initialize(tagsdir=tagsdir)
*) tagsdir is an absolute path to the tags package (the directory containing __init__.py and resload.py)
*) Use the following code to retrieve the XMP tags of an image file at abspath
Code: [Select]
taglist = tags.readxmp(abspath)
*) writexmp will only work if you have pyexiv2 installed; readxmp also works without pyexiv present;


3) Pytherworld
Pytherworld is a fangame for Otherworld, something of an reimagination of that game. It currently focuses on the slave training aspect, ignoring the brothel management aspect.
PyTFall could benefit by sharing code, concepts or ressources with Pytherworld. We can talk more about that when I share it's source code with you.


Update:
@Xela
Lets meet in the chat.
Sorry, I have to go right now. I'll be back later and look into this problem.
« Last Edit: August 04, 2013, 02:32:07 AM by rudistoned »

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: Image Tagger 0.1 Release Candidate 1
« Reply #4 on: August 04, 2013, 02:46:46 AM »
A small bug with resolutions. If I use standard ones, it's ok. If I set something like 800x800, 1000x1000 or 2000x2000, then the lower part of the window with all buttons hiding behind taskbar.
After that there is nothing I can do to fix it, even manual changing of resolution in options.json doesn't help.

Besides, you probably should resize opened pictures even more and free some additional space for tags section to avoid scrolling there as much as possible. There is no need in high resolutions during tagging anyway.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6881
  • "It's like hunting cows"
Re: Image Tagger 0.1 Release Candidate 1
« Reply #5 on: August 04, 2013, 03:02:57 AM »
Maybe some of you wondered were I disappeared too? Well, I felt like working on my own projects, so I did. Over the last month, I rewrote Image Tagger and Pytherworld to get rid of design errors I made when I knew a lot less about the MVC design paradigm, event-driven applications and Qt. I went surprisingly well and fast.

Hi :)

Yeah, I am surprised as well on how well development progresses as we gain more and more experience.


2) The tags package
This package allows your application to retrieve tags stored as XMP metadata from JPEGs and PNGs. It has other things to offer too, just take a look at the docstrings of its classes (for example, open a python interpreter, import the tags package and type help(tags)).


Quick how to:
*)Add this code to your program
Code: [Select]
import tags
tags.initialize(tagsdir=tagsdir)
*) tagsdir is an absolute path to the tags package (the directory containing __init__.py and resload.py)
*) Use the following code to retrieve the XMP tags of an image file at abspath
Code: [Select]
taglist = tags.readxmp(abspath)
*) writexmp will only work if you have pyexiv2 installed; readxmp also works without pyexiv present;

Maybe you can write a script that takes care of loading tags info into JSON files when you have time? There s no rush on that front, we'll trully need tags when new systems will be added past 1.0 release of PyTFall.


3) Pytherworld
Pytherworld is a fangame for Otherworld, something of an reimagination of that game. It currently focuses on the slave training aspect, ignoring the brothel management aspect.
PyTFall could benefit by sharing code, concepts or ressources with Pytherworld. We can talk more about that when I share it's source code with you.

I have a very old version of pytherworld somewhere. Waiting for an upgrade :)


Update:
@Xela
Lets meet in the chat.
Sorry, I have to go right now. I'll be back later and look into this problem.

I figured it out, ImageTagger was in Cyrillic folder. Images are showing correctly now that I relocated it.
Like what we're doing?

Offline rudistoned

  • Full Member
  • ***
  • Posts: 229
Re: Image Tagger 0.1 Release Candidate 1
« Reply #6 on: August 04, 2013, 04:04:37 AM »
Glad it works now. Image Tagger should be based on utf-8, which should be able to handle Cyrillic? Well, string encodings are somewhat fiddly in Python 2, so I'm not surprised it's causing problems. I hope it's not a big inconvenience.


Maybe you can write a script that takes care of loading tags info into JSON files when you have time? There s no rush on that front, we'll trully need tags when new systems will be added past 1.0 release of PyTFall.
IMHO the best way to do this would similar to the way I do it in Pytherworld:
Code: [Select]
picklefile = os.path.join(RESDIR, "chars.res")
if os.path.exists(picklefile):
    logger.info("loaded girl image metadata from pickled ressource")
    self.girls = tags.resload.ImageRessourceMap.from_pickle(picklefile)
else:
    girlimgdir = os.path.join(RESDIR, "chars")
    self.girls = tags.resload.ImageRessourceMap(["*.jpg", "*.png"], girlimgdir, picklepath=picklefile)
    self.girls.load()
    logger.info("created new girl image metadata")


RESDIR is an absolute path to the content directory of PyTFall
girlimgdir is an absolute path to the directory containing the girl images

This will find all JPGs and PNGs in girlimgdir or any subdirectory, extract XMP tags embedded in them and store that information in self.girls.tagmap. self.girls is an instance of an image ressource map, which has an attribute called tagmap. The tagmap is very similar to and the successor of the TagDatabase class I wrote for PyTFall. So, basically, what TagDatabase did for PyTFall can be accomplished with self.girls.tagmap. However, self.girls also can read XMP tags directly from images and provides a pickling mechanism to store that data in a pickled file (necessary as generating that data takes to long to do it every time to program starts). Writing and loading image tags from JSON is no longer necessary with the new system.


What I could do is write a script that transfers the tags.json data into XMP tags in the images. We'll see.




Oh, and if you think this thread should be in game design, feel free to move it. However, I don't intend to discuss the design of PyTFall a lot here, this thread is about the current version of Image Tagger, how to use it and problems it causes. Discussion of PyTFalls tagging system should be here: [size=78%]http://www.pinkpetal.org/index.php?topic=1895.0[/size]
« Last Edit: August 04, 2013, 04:20:13 AM by rudistoned »

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: Image Tagger 0.1 Release Candidate 1
« Reply #7 on: August 26, 2013, 05:24:50 AM »
I've been thinking, if Image Tagger will create a separate json file for tags instead of manipulating metadata, then if you want to add or change tags, you have to modify one small single file instead of changing a whole huge pack and uploading it once again.

Offline rudistoned

  • Full Member
  • ***
  • Posts: 229
Re: Image Tagger 0.1 Release Candidate 1
« Reply #8 on: August 27, 2013, 04:25:06 AM »
Yes, that's certainly true. When image metadata is used for tagging, the best model is IMHO to compile the tags into a single file before release and ship that with the game. Only the people doing the tagging need to download the latest version of the images. If every image pack is only tagged by one person, nobody has to repeatedly download the images. In addition, many game releases contain a complete set of their images anyway.


PyTFalls previous system of tags based on image file names has the same problem by the way (tag change requiring image redownload).



With that being said, I do believe that collaboration between many people is easier with tags stored in text files (JSON, XML, INI, ...), for several reasons (file size, version control tools and editing tools to name a few). Therefore, I intend to support text-file based tagging with Image Tagger at some point. Of course, text files also have several disadvantages. For example, any image that is renamed or moved into another folder loses its tags. If you combine a given image archive with a tag text file for an ealier/later "version" of this image archive (moving/renaming/adding/removing files changes the "version" of the image archive), some images will not find their tags because their path has changed. There is no easy way to go around this disconnection between tags and the images they describe. Part of a solution could be a checksum calculated from the image files. This would break as soon as the image file is changed (image optimization to reduce size, remove background and so on).


Adding support for text file based tagging to Image Tagger will require several steps:
1) Allow Image Tagger to export its tag memory for a particular image archive into a text file, probably a JSON file in the same format PyTFall currently uses.
At this point, tagging is still based on XMP metadata in the image files. However, Image Tagger users can create a snapshot of the tag memory in the form of a text file and distribute that file.
2) Allow Image Tagger to import text file based tag data and adapt the tags in its tag memory accordingly.
This creates the danger of destroying lots of tagging data if a user imports the wrong tag data text file and does not check the results of this import. There is also the question of how to handle images described in the tag data but not present in the file system (path changed or file deleted). At this point, XMP metadata is not necessary anymore.


Step 1) is easy and can be accomplished in about a week (depending on free time). I mean, if I get lucky, this could be done in a day, but experience shows I'm never that lucky...
Step 2) is harder due to the problems created by the disconnection between metadata and the image file introduced by abandoning XMP metadata.


Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: Image Tagger 0.1 Release Candidate 1
« Reply #9 on: August 28, 2013, 12:10:51 PM »
Of course, text files also have several disadvantages. For example, any image that is renamed or moved into another folder loses its tags.
Indeed. However, there is no need to give images specific names like in WM if we use tags. Sudden renaming of images will be a rare case. As for renaming folder, we might as well put tags files inside pics folders, so they will always be in the same place.

This would break as soon as the image file is changed (image optimization to reduce size, remove background and so on).
Well, ideally, all this should be done before you release a pack. I guess we could use a checksum, at least in order to throw a warning message in the beginning of the game.

On the other hand, people may dislike some images in packs. If a player wants to delete a couple of images, it shouldn't break the game.
« Last Edit: August 28, 2013, 12:12:47 PM by DarkTl »

Offline rudistoned

  • Full Member
  • ***
  • Posts: 229
Re: Image Tagger 0.1 Release Candidate 1
« Reply #10 on: August 29, 2013, 02:14:09 AM »
On the other hand, people may dislike some images in packs. If a player wants to delete a couple of images, it shouldn't break the game.
This should not be a problem. If an image can not be loaded, the game should just look for another image. Under certain circumstances, this might lead to infinite recursion, so we would need to count how often we have tried to find an image. Seems clumsy.

Maybe checksums really are the way to go?
*) moving (and probably also renaming) a file should not change the checksum
*) changing tags does not change the file and will not cause a recommit of the file in version control systems
*) tags can be stored in a text file in any format (JSON, XML, INI, ...)


Indeed. However, there is no need to give images specific names like in WM if we use tags. Sudden renaming of images will be a rare case. As for renaming folder, we might as well put tags files inside pics folders, so they will always be in the same place.
Renaming should be rare, that's true.
Having a tags file in every image folder is relatively messy. I did that in an earlier version of Image Tagger and did not really like it.
Consider this example:
*) you have released an image pack
*) the tagging system changes (a tag is renamed, a new tag is added)
*) you adapt your image pack to the change and want to release a new version of the image pack; Now you need a copy of the dirextory tree of your image pack plus the tags file for every directory. The easiest way to get this is probably to create a copy of the whole image pack, then do a recursive search for image files and delete all images. If all tags are in one file, you just release that file.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6881
  • "It's like hunting cows"
Re: Image Tagger 0.1 Release Candidate 1
« Reply #11 on: August 31, 2013, 06:45:26 AM »
Some thoughts on the topic at hand:

- I really like the idea of XMP - JSON combo, tags shipped in easy to read/load format, images contain all tag data for Image Tagging software. Seems like a perfect match. Image tagger should show "per girl" tags loaded from both, XMP and JSON so enduser could compare those on sight and update as required.

- Simpler approach to missing images would be adding a option that would force such check while loading database and remove non-existent once on catching the IOError. I would prefer show method itself not to bother with that. If someone plays the release version, we'll make sure such option is off, if player has downloaded or modded the game and is unsure about all images still being there, option can be enabled, slightly slowing down game loading process.

- Per girl JSON files are a better solution to one large file or per pack files (and only one I can currently think of that will work). One large file will create a mess that would make game almost impossible to mod. Per pack files will cause the same but to a lesser degree.

- We should not pay to much attention to what will happen if someone is to delete/move/rename a file. Mainly cause bad modding should not be our problem, in most commercial games if you rename graphics/textures/control files, game will break without any warnings. Checking for "path to file" should be more than enough.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: Image Tagger 0.1 Release Candidate 1
« Reply #12 on: August 31, 2013, 12:27:07 PM »
We should not pay to much attention to what will happen if someone is to delete/move/rename a file. Mainly cause bad modding should not be our problem, in most commercial games if you rename graphics/textures/control files, game will break without any warnings.
But modding itself is our problem, since we want a modifiable game. An example of bad modding design is Morrowind, which has a bad habit of throwing one warning message per mod after every single launching. Until you google how to add "yes to all" option to these warnings.

I believe we should provide an option to seamlessly add and remove images for players. There are always new images, two years ago when I was making packs for wm ex I didn't have as many pics as I have now for the same characters. And some of pics could be unpleasant for some people.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6881
  • "It's like hunting cows"
Re: Image Tagger 0.1 Release Candidate 1
« Reply #13 on: August 31, 2013, 03:25:04 PM »
But modding itself is our problem, since we want a modifiable game. An example of bad modding design is Morrowind, which has a bad habit of throwing one warning message per mod after every single launching. Until you google how to add "yes to all" option to these warnings.

And yet it had 100s of mods available for it :)

I believe we should provide an option to seamlessly add and remove images for players. There are always new images, two years ago when I was making packs for wm ex I didn't have as many pics as I have now for the same characters. And some of pics could be unpleasant for some people.

To add new image, player would have to mess with Tagger or JSON (or replacing image with another of the same name).

I've proposed a way on how to handle removed images.

There is no way to make it better than that while wishing to preserve tagging power.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: Image Tagger 0.1 Release Candidate 1
« Reply #14 on: September 01, 2013, 07:31:19 AM »
Sure, players have to work with Image Tagger to add images. What I mean by seamless removing is more advanced options within warning messages.

For example, if you deleted 2 images you get a message "2 images missing in pack X" with buttons like "Ok" and "Update the pack". If you chose to update, the game will delete strings with those images from json, and you will never see that warning again.