Блог пользователя HYPERHYPERHYPERCUBELOVER

Автор HYPERHYPERHYPERCUBELOVER, история, 9 лет назад, По-английски

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

  • Проголосовать: нравится
  • +672
  • Проголосовать: не нравится

»
9 лет назад, # |
Rev. 3   Проголосовать: нравится +68 Проголосовать: не нравится

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

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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.

»
9 лет назад, # |
  Проголосовать: нравится +46 Проголосовать: не нравится

god

»
9 лет назад, # |
  Проголосовать: нравится +131 Проголосовать: не нравится

_

I did it with cute Flareon :D

»
9 лет назад, # |
  Проголосовать: нравится +151 Проголосовать: не нравится

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

»
9 лет назад, # |
  Проголосовать: нравится +85 Проголосовать: не нравится

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 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 ?

»
7 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

-- edited --

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