开发者

Any simple method to make an image unrecognizable?

开发者 https://www.devze.com 2023-02-06 02:59 出处:网络
I want to make an image unrecognizable effeciently. I don\'t want to just make it completely black - I want people looking at this to be convinced that this is indeed a unique picture generated from

I want to make an image unrecognizable effeciently.

I don't want to just make it completely black - I want people looking at this to be convinced that this is indeed a unique picture generated from a picture they have seen before.

I tried blurring an image 100 times but it's slow as hell and I was wondering whether there would be some nice method to do so.

I was just thinking whether it is possible to just "shuffle pixels" in python strictly for this purpose.

Please help

I have taken some suggestions from you guys, and I have written the following:

imageFile = "myfile.png"
im1 = Image.open(imageFile)
l = list( im1.tostring())
random.shuffle(l)
Image.fromstring('RGB', (100,100), ''开发者_如何学编程.join(l) ).save('out.png')

EDIT: I pasted the code I wrote. It's pretty CPU intensive


Take one pixel from a 3x3 block and replace the block with it. Essentially you get a smaller image, though you don't have to resize it (which would make some images much too small to see). This is related to blurring, but is much simpler/faster and results in a pixellated effect rather than an optical blur.

For example:

xxxxxx
xAxxBx
xxxxxx
xxxxxx
xCxxDx
xxxxxx

Becomes:

AAABBB
AAABBB
AAABBB
CCCDDD
CCCDDD
CCCDDD

Vary the block size as desired.


Why not just shuffle the order of the pixels? Depending on how recognizable you want it to be, you can do it for individual pixels, or break the image into blocks and just shuffle those.


Apply a sequence of quick filters then. Blurring is CPU-intensive, so you go for inverting colours, switching pixel groups, flipping horizontally and/or vertically...


For a simplistic approach, you can use Python Imaging Library to apply color transforms, image enhancements, point operations, and a variety of other options as shown in the tutorial page.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号