Jump to content
Sign in to follow this  
Rox

[development tool] Map to Image exporter

Recommended Posts

Map to Image exporter

No need of endless screen capturing for lager maps.

<19-10-2012>

 

 

 

Summary

I came up with the idea when I was making parallax maps in Photoshop I use the maximum allowed size for my maps which means that making screenshots of every part of the mape and cutting them out in the right way so you get a seamless map is a a very time consuming and frustrating job. I was wondering if it is possible to let RPG maker export the map as a picture.

 

Searched

Yes I have searched for this script with google and on these forums.

Keywords where "Rpg Maker VX Ace Script Export Map to Image"

But didn't found anything.

 

I hope someone can make this script. I am guessing RPG maker transforms the maps in a few images to show the maps in game but I don't know for sure. I think this will help not only me but a lot other people who are into parallax mapping.

 

Many many thanx in advance,

 

 

Rox

<3

Share this post


Link to post
Share on other sites

Thanx, I tried it but as with some other persons, the script makes the program crash and I don't get something to work with.

So.... bump

Share this post


Link to post
Share on other sites

Your error report is not very useful. Have you tried the crash options?

If it doesn't work and you don't want to report the errors then I would suggest writing your own rather than asking someone to write something new for you and then run into the same issues.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

you could use omega7 map saver script converted to ace by yami.

 

you do have to credit both of them.

 

since i think finding them is difficult. i will share it to you here. but if someone found the link to the thread i guess i could remove this if neccesary

 

 

 

 


 

# =============================================================================

# Map Saver ACE

# Version 0.1

# Author: Yami

# Credit: Omegas7 for VX version Site: http://www.myrpgmaker.com

# Credit: Woratana for PNG Saver script.

# =============================================================================

# Save a whole map into a .png file by taking multiple screenshots and finally

# combining them. Exporting the resulting bitmap to a .png image file using

# Woratana's PNG Saver script.

# =============================================================================

# Instructions:

# Go to Paint or whatever image editing software you want.

# Create a new file, width and height will be the same as your map, but

# multiplied by 32. (If map's width is 20, the image's width will be 640).

# Name the image "Blank", and save it on the System folder of your game.

# Go to your game map, and put the player starting position on the

# bottom left part of the map.

# Now make a new event, autorun, with script call:

# $saver = Map_Saver.new

# Then turn self-switch A ON.

# Go to the event's second page, put as condition self-switch A, then put

# script call:

# $saver.update

# Finally make the second page to be autorun as well.

# Run the game, you will see the map will start scrolling. Let it be.

# At the end the script will start creating the image file, this process

# may take several minutes depending on your map's size.

# Sure, it may take very long, but it saves HOURS if you planned to make

# your map manually, so do not complain ;).

# =============================================================================

# Notes:

# The final result will be an image file located on your game's main folder.

# The image will be exactly what appears on the screen, so if you got a HUD,

# it will appear as well.

# If you notice a problem with the final result, like with tiles etc,

# try activating "weird mode" below.

# If the final result is still not fixed, try to get support.

# =============================================================================

 

class Map_Saver

def initialize

 

# If the resulting image seems to be wrongly made, try turning this value

# to "true". Normally, this should be false.

@weird_mode = false

 

@result = Bitmap.new('Graphics/System/Blank')

@bitmaps = []

@moving = true

@last_place = 'none'

@finishing = false

@pause_time = 30

@scrolling_x = 13

end

def update

if !(@finishing)

if !($game_map.scrolling?)

if @moving

execute_image

else

if can_move?(8)

$game_map.start_scroll(8, @scrolling_x, 7)

@moving = true

@last_place = 'down'

elsif can_move?(6) && @last_place == 'down'

$game_map.start_scroll(6, 17, 7)

@last_place = 'left'

elsif can_move?(2) && @last_place == 'left'

$game_map.start_scroll(2, $game_map.height, 9)

@last_place = 'up'

@moving = true

else

@finishing = true

for i in 0...@bitmaps.size

y = @bitmaps[2]*32

if @bitmaps[3] == true

y += 16 if @weird_mode

end

@result.blt(@bitmaps[1]*32,y,@bitmaps[0],

Rect.new(0,0,Graphics.width,Graphics.height))

end

@result.make_png('Map','')

print "Map image production is over!"

exit

end

end

end

end

end

def execute_image

Graphics.freeze

@bitmaps.push([Graphics.snap_to_bitmap,

$game_map.display_x,

$game_map.display_y,

nil])

@moving = false

Graphics.transition(@pause_time)

if can_move?(8) && can_move?(2)

@bitmaps[@bitmaps.size - 1][3] = true

end

end

def can_move?(direction)

case direction

when 6

return false if ($game_map.display_x) == ($game_map.width - Graphics.width / 32)

return true

when 2

return false if ($game_map.display_y) == ($game_map.height - Graphics.height / 32)

return true

when 4

return false if ($game_map.display_x == 0)

return true

when 8

return false if ($game_map.display_y == 0)

return true

end

end

end

 

# =============================================================================

# PNG Saver by Woratana.

# =============================================================================

module Zlib

class Png_File < GzipWriter

def make_png(bitmap, mode = 0)

@bitmap, @mode = bitmap, mode

create_loader

self.write(make_header)

self.write(make_ihdr)

self.write(make_idat)

self.write(make_iend)

end

def create_loader

w = @bitmap.width

h = @bitmap.height

@calculated = [0,nil]

@calculated[1] = (w*h).to_f

@window = Window_Base.new(0,150,544,116)

@window.contents.font.size = 16

@update = ((@bitmap.width*@bitmap.height)/3000.0).floor.to_i

refresh_loader

end

def refresh_loader

Graphics.update

@window.contents.clear

text = ['Creating image file, please wait...',

percent.to_s + '% done...']

for i in 0...text.size

@window.contents.draw_text(0,20*i,520,20,text)

end

Graphics.update

end

def percent

return ((100/@calculated[1])*@calculated[0]).floor

end

def make_header

return [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a].pack('C*')

end

def make_ihdr

ih_size = [13].pack('N')

ih_sign = 'IHDR'

ih_width = [@bitmap.width].pack('N')

ih_height = [@bitmap.height].pack('N')

ih_bit_depth = [8].pack('C')

ih_color_type = [6].pack('C')

ih_compression_method = [0].pack('C')

ih_filter_method = [0].pack('C')

ih_interlace_method = [0].pack('C')

string = ih_sign + ih_width + ih_height + ih_bit_depth + ih_color_type +

ih_compression_method + ih_filter_method + ih_interlace_method

ih_crc = [Zlib.crc32(string)].pack('N')

return ih_size + string + ih_crc

end

def make_idat

header = "\x49\x44\x41\x54"

data = @mode == 0 ? make_bitmap_data0 : make_bitmap_data1

data = Zlib::Deflate.deflate(data, 8)

crc = [Zlib.crc32(header + data)].pack('N')

size = [data.length].pack('N')

return size + header + data + crc

end

def make_bitmap_data0

gz = Zlib::GzipWriter.open('png2.tmp')

t_Fx = 0

w = @bitmap.width

h = @bitmap.height

data = []

for y in 0...h

data.push(0)

for x in 0...w

t_Fx += 1

if t_Fx % 10000 == 0

Graphics.update

end

if t_Fx % 100000 == 0

s = data.pack('C*')

gz.write(s)

data.clear

end

color = @bitmap.get_pixel(x, y)

red = color.red

green = color.green

blue = color.blue

alpha = color.alpha

data.push(red)

data.push(green)

data.push(blue)

data.push(alpha)

@calculated[0] += 1

if @calculated[0] % @update == 0

refresh_loader

end

end

end

s = data.pack('C*')

gz.write(s)

gz.close

data.clear

gz = Zlib::GzipReader.open('png2.tmp')

data = gz.read

gz.close

File.delete('png2.tmp')

return data

end

def make_bitmap_data1

w = @bitmap.width

h = @bitmap.height

data = []

for y in 0...h

data.push(0)

for x in 0...w

color = @bitmap.get_pixel(x, y)

red = color.red

green = color.green

blue = color.blue

alpha = color.alpha

data.push(red)

data.push(green)

data.push(blue)

data.push(alpha)

@calculated[0] += 1

if @calculated[0] % @update == 0

refresh_loader

end

end

end

return data.pack('C*')

end

def make_iend

ie_size = [0].pack('N')

ie_sign = 'IEND'

ie_crc = [Zlib.crc32(ie_sign)].pack('N')

return ie_size + ie_sign + ie_crc

end

end

end

#=============================================================================

# ** Bitmap

#=============================================================================

class Bitmap

def make_png(name = 'like', path = '', mode = 0)

Zlib::Png_File.open('png.tmp') { |gz| gz.make_png(self, mode) }

Zlib::GzipReader.open('png.tmp') { |gz| $read = gz.read }

f = File.open(path + name + '.png', 'wb')

f.write($read)

f.close

File.delete('png.tmp')

end

end

 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

@estriole

 

I was having a real hard time locating this again. Thanks for posting it there.

Share this post


Link to post
Share on other sites

Sorry for posting to an old post cats, but I am trying to export my large map and I get the error 


Script 'Game_Interpreter' line 1411: RGSSError occurred
failed to create bitmap.

Can anybody help me solve this problem?

Thanks in advance!

 

Share this post


Link to post
Share on other sites

If you're using my script, mine does not support very large maps. I don't know about other scripts.

I have not found a way to solve the problem.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

if the script NOT working for HUUUGEEE map... you could still have option to sceen capture it yourself using photoshop.

if you want something that not supported by the script. you must prepare for it.

if you don't want those tiresome work... just make smaller map please... (at least in the range the scripts supported).

Share this post


Link to post
Share on other sites

Well one option I considered was to take multiple images of the map and then ask the user to combine it themselves.

 

For example, if your map is 500x500 which is too big for my script, I might take a 300x300 image of the top-left, then take a 200x300 image for the top-right, and then do the same for the remaining two quadrants and export all 4 images out.

 

At least all they have to do it combine images somehow.

But I didn't work on it yet.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

@hime: if the script can do that it would be very very helpful... :D.

 

for now ...the user can just copy the map 4 times. break each map to parts which each part fit the script. run the script to get 4 mapshot. and combine it.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted