HYPERHYPERHYPERCUBELOVER's blog

By HYPERHYPERHYPERCUBELOVER, history, 8 years ago, In English

I have noticed a strange feature while conducting some experiments. Look at the following. My large profile picture and small profile picture look different.

I can't believe that.

You can see that my profile pictures look different here and here. Still not convinced? Upload this and check how your profile pictures are changed.

Why does this happen?

I uploaded this to change my profile picture. The result was interesting. The large profile picture was almost black, but the small was white. I thought that Codeforces uses Nearest-neighbor interpolation to scale pictures in proper sizes. (This is just a guess!)

Nearest-neighbor interpolation selects the value of nearest point and does not consider the values of neighboring points at all. I tracked which values are used and found how to make profile pictures look different.

So, how did you do it?

I used this python script to create a 3600x3600 image that will make your profile pictures look different. Requirements are Python 3 and PIL. First, save a 300x300 image that you would like you use as the large profile picture as pic1.png. Likewise, save a 80x80 image for the sub profile picture as pic2.png. Finally, run the script and upload pic.png. pic1.png will be the large profile picture, while pic2.png being the small profile picture.

I hope you love this feature :D

»
8 years ago, # |
Rev. 3   Vote: I like it +68 Vote: I do not like it

Thanks to Nemmo and .o. for revising this article.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I used your code several times, and it fail once because the image i was using had 4 channels instead of 3, (r, g, b, alpha). With a minor fix, it works perfectly.

»
8 years ago, # |
  Vote: I like it +46 Vote: I do not like it

god

»
8 years ago, # |
  Vote: I like it +131 Vote: I do not like it

_

I did it with cute Flareon :D

»
8 years ago, # |
  Vote: I like it +151 Vote: I do not like it

Man, that's the coolest blog I have seen in a while :D

»
8 years ago, # |
  Vote: I like it +85 Vote: I do not like it

Something similar: http://thume.ca/projects/2012/11/14/magic-png-files/

It also reminds me for this: CVE-2010-3970 Windows were using something more complicated than Nearest-neighbor interpolation to generate thumbnails, but it have an overflow bug and so one can embed any code into that picture to be executed when generating thumbnail.)

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Running the script gives an error : "IndexError : image index out of range " .

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I'm not sure but I think the resolution for the image your using is incorrect.

    use 300x300 resolution for the big image and 80x80 resolution for the small image.

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice post, kudos for you.

I don't know if this is really a feature or a bug, but I hope they keep it :)

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Just one thing, how to run the script? :p, I know I'm stupid but please can you help me ?

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Save that code in something like "compress.py". Then put the script + the 2 png files in the same folder, go into the folder path using the terminal and run "Python3 compress.py". If the pics have the right sizes then the script will generate the pic.png file for you. Also, thank you HYPERHYPERHYPERCUBELOVER for sharing this with us :).

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Thank you very much man this was the coolest trick of all times.

P.S: can you use it on other websites like Facebook for example ?

»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

-- edited --

Oh well, I suppose this feature is not working anymore (at least for now.)