also google hat mir folgendes script rausgespuckt. es speichert aber nicht in png/jpg sondern bmp. Code: #============================================================================= # *** Aleworks Bitmap(ABMP) #============================================================================= # Created by Aleworks(vgvgf) # Version: 1.00 # Last Modification: 21/04/2007 (day/month/year) #============================================================================= #==== Description ==== # This script allows to save a bitmap file(bmp) from the RGSS Bitmap class image. #============================================================================= #============================================================================= #==== Classes & Methods ==== # * Module ABMP # - Methods # - ABMP.save(bmp, filename[, background_color[, prevent_hang_up]]) # Saves the 'bmp' image to the filename file. Filename needn't have # the .bmp extension. If background_color is a Color class, then the saved # bitmap will have the given color. If it's not given will be nil. # If prevent_hang_up is true, the script will call Graphics.update each # 6 seconds aproximately for preventing the game to close by hang up. If # it is not given, it will be true. You can add a block to the method, that # will return the completed porcentage of the proccess. # Note: bitmap images don't support transparency, so all colors that # have transparency will be writed with full opacity. Also, this is a very # time consuming method so avoid using it constantly. # - check_hang_up # Called internaly for checking if the Graphics need to be updated. #============================================================================= #============================================================================= # ** Module ABMP #============================================================================= module ABMP #--------------------------------------------------------------------------- # * ABMP.save #--------------------------------------------------------------------------- def self.save(bmp, filename, background_color = nil, prevent_hang_up = true) if File.extname(filename) != '.bmp' filename += '.bmp' end if !background_color.nil? temp_bmp = bmp.clone rect = Rect.new(0, 0, temp_bmp.width, temp_bmp.height) bmp = Bitmap.new(temp_bmp.width, temp_bmp.height) bmp.fill_rect(rect, background_color) bmp.stretch_blt(rect, temp_bmp, rect) temp_bmp.dispose Graphics.update if prevent_hang_up end file = File.open(filename, 'wb') file.write('BM') file.write([54 + (bmp.width * bmp.height * 24) / 8].pack('L')) file.write('ABMP') file.write([54].pack('L')) file.write([40].pack('L')) file.write([bmp.width].pack('L')) file.write([bmp.height].pack('L')) file.write([1].pack('L')[0, 2]) file.write([24].pack('L')[0, 2]) file.write([0, 0, 0, 0, 0, 0].pack('L6')) null_spaces = 0 if bmp.width / 4 != bmp.width / 4.0 if (bmp.width + 1) / 4 == (bmp.width + 1) / 4.0 null_spaces = 1 elsif (bmp.width + 2) / 4 == (bmp.width + 2) / 4.0 null_spaces = 2 elsif (bmp.width + 3) / 4 == (bmp.width + 3) / 4.0 null_spaces = 3 end end time = Time.now last_porcentage = -1 for y in (-bmp.height + 1)..0 line = '' for x in 0...bmp.width color = bmp.get_pixel(x, y.abs) line += [color.blue.to_i].pack('L')[0, 1] line += [color.green.to_i].pack('L')[0, 1] line += [color.red.to_i].pack('L')[0, 1] time = self.check_hang_up(time) if prevent_hang_up if block_given? porcentage = (((y + bmp.height) * bmp.width + x)) * 100 porcentage /= bmp.height * bmp.width if porcentage > last_porcentage yield porcentage last_porcentage = porcentage end end end file.write(line) time = self.check_hang_up(time) if prevent_hang_up end file.close end #--------------------------------------------------------------------------- # * check_hang_up #--------------------------------------------------------------------------- module_function def check_hang_up(time) if time.sec <= Time.now.sec - 6 or time.min != Time.now.min Graphics.update return Time.now end return time end end credits gehen an vgvgf (steht ja auch im script)
#============================================================================= # *** Aleworks Bitmap(ABMP) #============================================================================= # Created by Aleworks(vgvgf) # Version: 1.00 # Last Modification: 21/04/2007 (day/month/year) #============================================================================= #==== Description ==== # This script allows to save a bitmap file(bmp) from the RGSS Bitmap class image. #============================================================================= #============================================================================= #==== Classes & Methods ==== # * Module ABMP # - Methods # - ABMP.save(bmp, filename[, background_color[, prevent_hang_up]]) # Saves the 'bmp' image to the filename file. Filename needn't have # the .bmp extension. If background_color is a Color class, then the saved # bitmap will have the given color. If it's not given will be nil. # If prevent_hang_up is true, the script will call Graphics.update each # 6 seconds aproximately for preventing the game to close by hang up. If # it is not given, it will be true. You can add a block to the method, that # will return the completed porcentage of the proccess. # Note: bitmap images don't support transparency, so all colors that # have transparency will be writed with full opacity. Also, this is a very # time consuming method so avoid using it constantly. # - check_hang_up # Called internaly for checking if the Graphics need to be updated. #============================================================================= #============================================================================= # ** Module ABMP #============================================================================= module ABMP #--------------------------------------------------------------------------- # * ABMP.save #--------------------------------------------------------------------------- def self.save(bmp, filename, background_color = nil, prevent_hang_up = true) if File.extname(filename) != '.bmp' filename += '.bmp' end if !background_color.nil? temp_bmp = bmp.clone rect = Rect.new(0, 0, temp_bmp.width, temp_bmp.height) bmp = Bitmap.new(temp_bmp.width, temp_bmp.height) bmp.fill_rect(rect, background_color) bmp.stretch_blt(rect, temp_bmp, rect) temp_bmp.dispose Graphics.update if prevent_hang_up end file = File.open(filename, 'wb') file.write('BM') file.write([54 + (bmp.width * bmp.height * 24) / 8].pack('L')) file.write('ABMP') file.write([54].pack('L')) file.write([40].pack('L')) file.write([bmp.width].pack('L')) file.write([bmp.height].pack('L')) file.write([1].pack('L')[0, 2]) file.write([24].pack('L')[0, 2]) file.write([0, 0, 0, 0, 0, 0].pack('L6')) null_spaces = 0 if bmp.width / 4 != bmp.width / 4.0 if (bmp.width + 1) / 4 == (bmp.width + 1) / 4.0 null_spaces = 1 elsif (bmp.width + 2) / 4 == (bmp.width + 2) / 4.0 null_spaces = 2 elsif (bmp.width + 3) / 4 == (bmp.width + 3) / 4.0 null_spaces = 3 end end time = Time.now last_porcentage = -1 for y in (-bmp.height + 1)..0 line = '' for x in 0...bmp.width color = bmp.get_pixel(x, y.abs) line += [color.blue.to_i].pack('L')[0, 1] line += [color.green.to_i].pack('L')[0, 1] line += [color.red.to_i].pack('L')[0, 1] time = self.check_hang_up(time) if prevent_hang_up if block_given? porcentage = (((y + bmp.height) * bmp.width + x)) * 100 porcentage /= bmp.height * bmp.width if porcentage > last_porcentage yield porcentage last_porcentage = porcentage end end end file.write(line) time = self.check_hang_up(time) if prevent_hang_up end file.close end #--------------------------------------------------------------------------- # * check_hang_up #--------------------------------------------------------------------------- module_function def check_hang_up(time) if time.sec <= Time.now.sec - 6 or time.min != Time.now.min Graphics.update return Time.now end return time end end
--Es ist ein magisches Liopleurodon =D
Foren-Regeln