Jump to content

Grisaia no Kajitsu sprite extraction


Haxton Fale

Recommended Posts

Hello everyone!

For the past few days I've been trying to extract sprites from Grisaia no Kajitsu, although this is not an easy battle. I got to the unpacking and converting images (thanks to asmodean's toolset), I got ImageMagick to quickly convert tens of thousands (over 55 000 for sprites alone) of images easily but...

jT54nkCs.png

The original sprite base

 

For some reason, the transparency has been replaced with black. And this is how original files look like, apparently. So, using the best tool at my disposal - Occam's razor - I deduced that there are no #000000 pixels within the sprite itself!

P2BPfCKs.png

Oops~

Unfortunately, I was wrong.

The next idea: floodfill! There are pure black pixels within the sprite, but they probably don't touch the exterior.

P2BPfCKs.png

Not really, no

The effect is a little better, but still bad. Plus there are transparencies inside some sprites, which means more potential manual fixing, which got much harder now that I know I can't use floodfill. Did I also mention the sheer number of these? Let me repeat: 55 611 character sprite components I'm interested in. Way too many to search manually each and every image for individual blemishes, edge cases and so on.

 

I'm looking for ideas now. There has to be a method for quick and efficient solution (any automation for over seventy thousand images is efficient, to be honest), since the game engine does this on its own, without human help. I'm thinking there might be a mask to decode these - I would really appreciate it if some kind soul helped me find them (I don't have a reasonably powerful computer for the time being, and hence extraction and conversion are rather time-consuming), or another way to do that.

Link to comment
Share on other sites

Hm, never worked too much Imagemagick, but there ARE masks for working with an images alpha-channel (which I assume are used for the transparency of the face-overlays): http://www.imagemagick.org/Usage/masking/#alpha_on

 

I read about this very problem some time ago, but unfortunately can't find the thread again. :(

Link to comment
Share on other sites

The alpha masks are actually contained in the BMP files. Certain programs don't really play well with BMP files that have an alpha channel and they'll sometimes ignore it completely.

 

I'll just leave this tool here.... it's a command-line program which takes the BMP files and converts them to PNG with the alpha data intact. You can write a batch file to automate the conversion process, though it will surely take a long time to get those 77 thousand files converted.

Link to comment
Share on other sites

Is this different than ImageMagick's mogrify? I'll give this one a go, but mogrify with various -alpha flags aiming to preserve the alpha channel information and simply activate it did nothing.

EDIT: It actually works. It also accepts batch parameters, which means it works when just given "*.bmp" as an argument. Thanks a lot, and wonder why ImageMagick didn't do that...

Link to comment
Share on other sites

Supposedly IM can handle RGBA BMPs but as you've found out, there is a difference between the spec and the real world. Officially there is a provision in the spec for RGBA but virtually no implementations can handle it.

The real question here, to those writing image extractors, is why aren't you using PNG?! It's standardised, supports almost any data format (including RGBA) and has built-in lossless compression so you also get storage savings.

Link to comment
Share on other sites

My assumption is that it's just extraction and not conversion, especially with the kind of work that's being done on the files (I've seen the C++ source, it's added to the toolkit).

That, or asmodean is too lazy (or can't handle PNG) to implement conversion at the end. The tools should be lightweight and quick, given sometimes the amount of files to be extracted/converted... not that it's an excuse.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...