Jump to content

Bluish character sprites

Recommended Posts

And so I found an extractor that worked with Ciel's Arcana, and had a look at the files inside. Most of the stuff is more or less straightforward, except that I noticed something strange about the character sprite images. All of them seem to be tinged somewhat blue. I take it that this is a special way of encoding alpha transparency without an explicit mask or alpha channel, but I can't for the life of me figure it out. Here's an example of what I'm talking about:


For comparison, here's the same character as she appears in the game itself:


Notice how her wings show alpha compositing effects. Is anyone familiar with this technique and can give me a hint as to how to extract the true colours of the image and the alpha channel from it?

Link to comment
Share on other sites

Something isn't quite right with the extractor/converter.


In your extracted image, I see that the color channels aren't in the correct order...

-the blue channel -> alpha!

-the green channel -> blue channel

-the red channel -> green channel

-the actual red channel is missing! but if you followed the pattern, the alpha channel -> red channel


Whatever method you used to convert the original BMP to PNG did not preserve the alpha channel.


Here is the converted sprite with the alpha channel:



and then here is the corrected sprite with the channels swapped:


Link to comment
Share on other sites

Hmm, the extractor produced .BMP files, and it might be that either the extractor failed to decode alpha channel information properly or the Gimp, which I used to convert the original .BMP into the .PNG that I uploaded, didn't read it correctly for some reason. It worked properly for all of the other graphics assets in the game though, except the character sprites, which is odd. Looks like it might be time to be digging into the extractor code...  8)  Thanks for the hint!

Link to comment
Share on other sites

Thanks to these hints I managed to get the .BMP files converted properly to .PNGs with the help of this quick and dirty Ruby script:

#!/usr/bin/env ruby
require 'tempfile'
name = ARGV[0]
basename = File.basename(name, ".bmp")
puts name
File.open(ARGV[0]) do |fp|
  width = fp.read(4).unpack("v").first
  height = fp.read(4).unpack("v").first
  offset = fp.read(4).unpack("v").first
  puts "#{width}x#{height} offset #{offset}"
  data = fp.read(width*height*4)
  tf = Tempfile.new([ARGV[0], ".rgba"])
  system("/usr/bin/convert -size #{width}x#{height} -depth 8 -flip -recolor '0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0' #{tf.path} #{basename}.png")

The key portion is the ImageMagick convert call down near the bottom and that recolor matrix. It seems there's hardly any software out there that can handle BMP files with alpha channels correctly, so we have to do this kind of hack.

Link to comment
Share on other sites

Most can, but alpha is only supported in 32-bit BMPs, which aren't standard (24-bit is the standard as far as I've seen, which is missing the alpha channel). I don't know how GIMP works, but with Photoshop you only specify the format to save or lose the alpha when saving, where you need to select 32-bit and you can then choose to save alpha. GIMP should have something similar, there's no way it won't handle alpha.

Link to comment
Share on other sites

The extractor should be working okay.


It's the image converter... Many graphics editing tools like to ignore the alpha channel in BMP images, that includes Gimp. Although I actually used Gimp to do the channel swapping after I converted them to PNG.


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.

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...