84648488
Chunk
reverted.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import jpeg
import sys
import random
a = jpeg.Jpeg(sys.argv[1])
def swap(list,a,b):
tmp = list[a]
list[b] = list[a]
list[a] = tmp
comps = a.component_count
for comp in range(comps):
blocks = []
xmax, ymax = a.getcomponentdimensions(comp)
for y in range(ymax):
for x in range(xmax):
blocks.append(a.getblock(x,y,comp))
random.shuffle(blocks)
i = 0
for y in range(ymax):
for x in range(xmax):
a.setblock(x,y,comp,blocks[i])
i += 1
a.write(sys.argv[2])
|