How to convert PNG to HTML code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Netcracker
    Rookie
    • May 2014
    • 9

    How to convert PNG to HTML code?

    Hi, I recently took a screenshot with Angband. The file was saved in PNG format. Now I would like to upload it in the screenshots section but first I have to convert it to HTML code because PNG isn't allowed. How do I do that? Thanks for your help!
    This seems a quiet, peaceful place.
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9634

    #2
    Sorry, but you need to take the screenshot in game, using the ')' command. That will save an html screenshot in your user directory.
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.

    Comment

    • Netcracker
      Rookie
      • May 2014
      • 9

      #3
      Too bad. I found this webpage here where PNGs can be converted to base64 strings. Works great with IE 11 for example. But the upload script does not accept the generated string unfortunately.
      This seems a quiet, peaceful place.

      Comment

      • Patashu
        Knight
        • Jan 2008
        • 528

        #4
        Originally posted by Netcracker
        Too bad. I found this webpage here where PNGs can be converted to base64 strings. Works great with IE 11 for example. But the upload script does not accept the generated string unfortunately.
        There is a fundamental misunderstanding here.
        A PNG can be viewed in two different ways:
        1) To the computer, it is a long string of binary data. (You can open it in a hex editor to see this view.)
        2) When displayed to the user, it contains meaningful visual information, such as in this case showing the layout of a dungeon.

        It's very easy to manipulate the PNG in terms of 1). What you've found is a program that takes the binary representation of the PNG (the data that it is written as on a hard drive) and transforms it into the base64 equivalent - which is the exact same data, just in a form that can be sent over a text-only means of communication, such as an email, then un-base64'd to get the original PNG. Needless to say, the angband.oook.cz server has no idea what to do with a base64'd PNG just as much as it doesn't know what to do with a GIF, BMP or random text hammered into the submission box.
        What you are looking for is manipulating the PNG in terms of 2). As in, you want to represent the visual information of the PNG in another way - in terms of the symbols and colours and characters contained within it, in such a way that you could pass this information around as text. This is a difficult problem, because computers have no innate idea of what it means to parse an image - this problem is called Optical Character Recognition. http://en.wikipedia.org/wiki/Optical...er_recognition

        There are plenty of OCR programs out there - that are great at extracting the text from a scanned or screenshotted paper, for example - but I find it very unlikely that it would maintain the 1) colour information 2) specific monospacing that you would need, which is not something that matters for the use cases OCR is developed for. So, there is probably no easy solution for what you want.
        My Chiptune music, made in Famitracker: http://soundcloud.com/patashu

        Comment

        • Netcracker
          Rookie
          • May 2014
          • 9

          #5
          Okay thank you. Next time I'll use the ')' command.

          By the way, why it is forbidden to upload images? If size matters the maximum image file size and dimensions could be limited.
          This seems a quiet, peaceful place.

          Comment

          • Derakon
            Prophet
            • Dec 2009
            • 9022

            #6
            Pav wrote the website, so it's his decision, but one reason I can think of is to avoid having random people use the screenshot section for image hosting of images unrelated to Angband.

            Comment

            • Netcracker
              Rookie
              • May 2014
              • 9

              #7
              That sounds reasonable indeed.
              This seems a quiet, peaceful place.

              Comment

              • Patashu
                Knight
                • Jan 2008
                • 528

                #8
                Also, PNGs can't be read by blind people using screen reading programs, whereas HTML 'screenshots' can be. (Yes! A lot of blind or partially blind people play text and ASCII based games.)
                My Chiptune music, made in Famitracker: http://soundcloud.com/patashu

                Comment

                Working...
                😀
                😂
                🥰
                😘
                🤢
                😎
                😞
                😡
                👍
                👎