Haxton Fale Posted September 22, 2013 Posted September 22, 2013 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...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!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.Not really, noThe 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. Quote
Nayleen Posted September 22, 2013 Posted September 22, 2013 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. Quote
Haxton Fale Posted September 22, 2013 Author Posted September 22, 2013 I know about using masks with ImageMagick, but currently I'm concerned with finding the masks themselves - they are most likely saved/encoded somewhere, and I just need to find them. That, or a different method of conversion. Quote
binaryfail Posted September 22, 2013 Posted September 22, 2013 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. Quote
Haxton Fale Posted September 22, 2013 Author Posted September 22, 2013 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... Quote
REtransInternational Posted September 23, 2013 Posted September 23, 2013 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. Quote
Haxton Fale Posted September 23, 2013 Author Posted September 23, 2013 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.