Advertisement
MaxDvc

rowColumnSwap

Dec 13th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. def rowColumnSwap(pict,k):
  2. #@param:
  3. #   pict: picture;
  4. #   k: int;
  5.     assert getWidth(pict)==getHeight(pict), "Picture is not square"
  6.     assert k<getWidth(pict) and k>=0, "Parameter is smaller than 0 or bigger than picture size."
  7.     for i in range(0,getWidth(pict)):
  8.         pix1 = getPixel(pict,i,k)
  9.         pix2 = getPixel(pict,k,i)
  10.         col1 = getColor(pix1)
  11.         col2 = getColor(pix2)
  12.         setColor(pix1,col2)
  13.         setColor(pix2,col1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement