Saving image in python
<p>I'm new to python. What I want to do is to read in an image, convert it to gray value and save it.</p>

<p>This is what I have so far:</p>

<pre><code># construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the image")
args = vars(ap.parse_args())

#Greyvalue image
im = Image.open(args["image"])
im_grey = im.convert('LA') # convert to grayscale
</code></pre>

<p>Now my problem is how to save it. As far as I unterstood there are a lot of different modules (Using python 2.7) Could someone give my an example?</p>

<p>Thanks</p>

<p><strong>Method 1: save method</strong></p>

<pre><code>im_grey.save('greyscale.png')
</code></pre>

<p>Use Image_object.save() method</p>

<p><strong>Method 2: imsave method</strong></p>

<pre><code>import matplotlib.image as mpimg
mpimg.imsave("greyscale.png", im_grey)
</code></pre>

python image save