Works on Coot (Will be installed in Extension menu)
Works on Coot (Will be installed in Extension menu)
# This script works on Coot. # Save screen image with white background, ball-stick representation, and black mesh for Gakusei Jikken. # # Ver. 2 of http://codetter.com/?p=400 # by yam_cpp, 2011-10-31 # def save_png_gakusei(arg): def get_displayed_maps(): displayed_maps = [] for i in range(graphics_n_molecules()): if map_is_displayed(i): print i, "is displayed map." displayed_maps.append(i) return displayed_maps # get_displayed_maps() def change_representation(ballstick): # http://biop.ox.ac.uk/coot/doc/coot/Ball-and-Stick-Representation.html # (make-ball-and-stick imol atom-selection bond-thickness sphere-size draw-spheres-flag) for i in range(graphics_n_molecules()): if mol_is_displayed(i): if ballstick: make_ball_and_stick(i, "*", 0.2, 0.3, 1) else: clear_ball_and_stick(i) # get_displayed_mols() # Assuming only one map is displayed displayed_map = get_displayed_maps()[0] # save map colour to restore later save_previous_map_colour(displayed_map) # change map & background colour and set ball-stick representation set_map_colour(displayed_map, 0, 0, 0) brighten_maps() set_background_colour(255,255,255) change_representation(True) # save image screendump_image(time.strftime("coot-%Y%m%d_%H%M%S.png")) # restore set_background_colour(0,0,0) darken_maps() restore_previous_map_colour(displayed_map) change_representation(False) # save_png_gakusei() add_simple_coot_menu_menuitem(coot_menubar_menu("Extensions"), "Save Image", save_png_gakusei)