×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Sep 2009
    Posts
    285

    Using Python 'Edit Images' tutorial - storing image as grayscale

    Hi!

    I'm trying to convert an image from a colourful jpg to a gray scale image. I am trying to follow the 'image editing' tutorial (can be found here).

    I initially load the image into variable img :
    from graphics import *
    img = Image.open("D:\\colour.jpg")
    Now, I transpose it (or do any action on the variable img). But, I finally need to save it as a grayscale image. Hence, I try to save it with the command -
    img.save("D:\\grayscale.jpg", quality=100, bpp=1, compression="no")
    The idea is to save the image with a 1 byte per pixel (bpp=1) and without any further compression (compression="no"). However, when I give the command and access the grayscale.jpg image, it is exactly the same as the initial image (==> no grayscale conversion occurs).

    Have I missed out some step in the transformation of the colour to the grayscale image?

    Thanks for the help..

    Kedar
    Last edited by kedarm; 2009-12-03 at 07:43. Reason: Typo error - corrected

  2. #2
    Regular Contributor
    Join Date
    Sep 2009
    Posts
    285

    Re: Using Python 'Edit Images' tutorial - storing image as grayscale

    Just wanted to update my post:

    I found a work-around - blit the image on another image which has the required format. It did the trick for me!
    Last edited by kedarm; 2009-12-03 at 18:54.

Similar Threads

  1. Replies: 5
    Last Post: 2009-07-20, 18:41
  2. How to edit Python files on the phone itself?
    By tristanr in forum Symbian
    Replies: 6
    Last Post: 2005-11-22, 01:38
  3. Replies: 11
    Last Post: 2005-05-20, 10:09
  4. Images in Python
    By grant_tg83 in forum Symbian
    Replies: 1
    Last Post: 2005-05-06, 09:18
  5. How can i manage image with python
    By darly in forum Symbian
    Replies: 1
    Last Post: 2005-02-16, 09:14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×