manipulating pixel colors in image media



manipulating pixel colors in image media

0 0


COMP7615A1

Image/Audio/Video Manipulation in Python

On Github brijshah / COMP7615A1

manipulating pixel colors in image media

brij shah / callum styan

grayscale

objective/problem

objective:

 

 

problem:

technical implementation

  • our solution uses a library for python called 'PIL'
  • allows us to open, manipulate, save many different image formats
  • PIL = python image library

computing techniques

  • .convert
  • .save
  • .show
  • .filter

code walk-thru

static PyObject* 
_convert(ImagingObject* self, PyObject* args)
{
    char* mode;
    int dither = 0;
    ImagingObject *paletteimage = NULL;

    if (!PyArg_ParseTuple(args, "s|iO", &mode, &dither, &paletteimage))
	return NULL;
    if (paletteimage != NULL) {
      if (!PyImaging_Check(paletteimage)) {
	PyObject_Print((PyObject *)paletteimage, stderr, 0);
	PyErr_SetString(PyExc_ValueError, "palette argument must be image with mode 'P'");
	return NULL;
      }
      if (paletteimage->image->palette == NULL) {
	PyErr_SetString(PyExc_ValueError, "null palette");
	return NULL;
      }
    }

    return PyImagingNew(ImagingConvert(self->image, mode, paletteimage ? paletteimage->image->palette : NULL, dither));
}
					

examples

'good'

put some text here???

'not so good'

put some text here???

conclusions

limitations

put text here swagins

the end.