3.2 How to save a modified image ? ########################################## Simple example ------------------------------------------------ The following script loads an image, adds an offset of 100 and saves the modified image:: # -*- coding: iso_8859_1 -*- from aspylib import astro #------ image names ------ Folder = u"C:\\Images\\" Image_in = [Folder + "Image-in.fit"] Image_out = [Folder + "Image-out.fit"] #--- loads image data and headers --- data = astro.get_imagedata(Image_in) headers = astro.get_headers(Image_in) #--- adds offset to data --- data = data + 100.0 #--- saves modified image --- astro.save_imagelist(data, headers, Image_out) raw_input() That's all ! In the last instruction (astro.save_imagelist): * the object "data" is a 2-dimensional or 3-dimensional array of numbers (more precisely, a Numpy array) * the object "headers" is a Python dictionary, * the object "Image_out" is a Python list. The Python lists have been already explained in the previous chapter (5.1). How the image data and the headers are organised and how they can be manipulated is explained in the next chapters (5.3 and 5.4).