RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

RMVX icons to RMXP

Started by tmacery, February 11, 2013, 10:35:01 PM

0 Members and 1 Guest are viewing this topic.

tmacery

I was wondering if someone could separate this group of icons into single icons. I hope it isn't too much to ask :( I'll leave an attachment of the file.

XaXaV

I've created a script which splits the IconSet file you decide into separate icons :)
Use it if you want to split another IconSet files :)
I've already split yours. See the attachments :)

#==============================================================================#
# * IconSet Splitter (By XaXaV)                                                #
#------------------------------------------------------------------------------#
XXV_IconSplit_Filename = "IconSet" # The file should be in the game directory.
#==============================================================================#
class Bitmap
 
  def print_out(id)
    name = "XSIcon-#{id}"
    File.open("./XSIcons/#{name}.png", "wb") do |f|
      f.write("\211PNG\r\n\032\n" + png_ihdr + png_idat + "\000\000\000\000IEND" + [Zlib.crc32("IEND")].pack('N'))
    end
    return "#{name}.png"
  end
 
  def png_ihdr
    string = "IHDR" + [self.width].pack("N") + [self.height].pack("N") + "\010\006\000\000\000"
    ih_crc = [Zlib.crc32(string)].pack("N")
    return "\000\000\000\r" + string + [Zlib.crc32(string)].pack("N")
  end
 
  def png_idat
    data = Zlib::Deflate.deflate(make_png_data, 8)
    return [data.length].pack("N") + "\x49\x44\x41\x54" + data + [Zlib.crc32("\x49\x44\x41\x54" + data)].pack("N")
  end
 
  def make_png_data
    data = []
    for y in 0...self.height
      data.push(0)
      for x in 0...self.width
        color = self.get_pixel(x, y)
        data.push(color.red, color.green, color.blue, color.alpha)
      end
    end
    string = data.pack("C*")
    data.clear
    return string
  end
 
end
#------------------------------------------------------------------------------#
Dir.mkdir("./XSIcons") rescue nil
$prog = Sprite.new
$prog.bitmap = Bitmap.new(416, 24)
$prog.x = (Graphics.width - 416)/2
$prog.y = (Graphics.height - 24)/2
$prog.bitmap.clear
$ind = 1

iconset = Bitmap.new("./#{XXV_IconSplit_Filename}")
max = ((iconset.width/24)*(iconset.height/24))
for i in 0...max
  Graphics.update
  $prog.bitmap.clear
  $prog.bitmap.draw_text(0, 0, 416, 24, "#{$ind}/#{max}", 1)
  out = Bitmap.new(24, 24)
  src = Rect.new(i % 16 * 24, i / 16 * 24, 24, 24)
  out.blt(0, 0, iconset, src)
  out.print_out(i)
  out.dispose
  $ind += 1
end
$prog.dispose
#==============================================================================#
I'm crazy as much as I want to be.

tmacery

OMG you are such a huge help. You're like my bestfriend right now lol. Thanks a bunch!  :tpg:

tmacery

line 46: $prog.x = (Graphics.width - 416)/2

I'm having a problem with this line. :)

XaXaV

I'm glad to help :)

That error raises because you are maybe using RMXP... Don't you?
If so, change  Graphics.width  with  640  and  Graphics.height  with  480
That should fix it :)
I'm crazy as much as I want to be.

tmacery

Thanks so much. You are so help! :)

XaXaV

:) If you need anything else just tell me ;)
I'm crazy as much as I want to be.