public function save( $fileName = NULL, $type = NULL )
	{
		if( !$type )
			$type	= $this->type;
		if( !$fileName )
			$fileName	= $this->fileName;
		if( !$fileName )
			throw new RuntimeException( 'No image file name set' );
		switch( $type )
		{
			case IMAGETYPE_GIF:
				return imagegif( $this->resource, $fileName );
			case IMAGETYPE_JPEG:
				return imagejpeg( $this->resource, $fileName, $this->quality );
			case IMAGETYPE_PNG:
				return imagepng( $this->resource, $fileName );
			default:
				throw new Exception( 'Image type "'.$type.'" is no supported' );
		}
		if( $fileName === $this->fileName )															//  if saved to same file
			$this->load( $this->fileName );															//  reload image
	}