Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. Please tell me about dithering. How can I change color depth of bmp 24 bits to bmp 4 bits?

Please tell me about dithering. How can I change color depth of bmp 24 bits to bmp 4 bits?

Scheduled Pinned Locked Moved Algorithms
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FlytotheBluesky
    wrote on last edited by
    #1

    Hi! Please tell me about dithering algorithm clearly. I try to change color depth of bmp 24 bits to 4 bits, but my algorithm is not good...Then someone tell me about dithering, but not clearly, they don't give me an algorithm or clear idea but that's an introduction about dithering...So if you can, please tell me about dithering algorithm clearly. Thanks and waiting for your replies. Best regards, FlytotheBlueSky

    R R U 3 Replies Last reply
    0
    • F FlytotheBluesky

      Hi! Please tell me about dithering algorithm clearly. I try to change color depth of bmp 24 bits to 4 bits, but my algorithm is not good...Then someone tell me about dithering, but not clearly, they don't give me an algorithm or clear idea but that's an introduction about dithering...So if you can, please tell me about dithering algorithm clearly. Thanks and waiting for your replies. Best regards, FlytotheBlueSky

      R Offline
      R Offline
      RabidHamster
      wrote on last edited by
      #2

      A simple, efficient, and effective solution is error diffusion. The idea is to find the error between the color you want and the color you can produce. You move that error into neighboring pixels. The error accumulates until it reaches the threshold for the next representable color. The effect is surprisingly good. The algorithm as documented is good for one dimension of color (monochrome). The full color spectrum has three dimensions, so you'll have to apply error diffusion on all three individually. Try it with the red, green, and blue values and see how it works out. If that doesn't look good enough, post again and I'll dig up my HLS color code.

      U 1 Reply Last reply
      0
      • F FlytotheBluesky

        Hi! Please tell me about dithering algorithm clearly. I try to change color depth of bmp 24 bits to 4 bits, but my algorithm is not good...Then someone tell me about dithering, but not clearly, they don't give me an algorithm or clear idea but that's an introduction about dithering...So if you can, please tell me about dithering algorithm clearly. Thanks and waiting for your replies. Best regards, FlytotheBlueSky

        R Offline
        R Offline
        Rilhas
        wrote on last edited by
        #3

        My answer does not address your question directly, since a good answer has already been given. I just wanted to remind you that if you are doing this to conserve space you will only get a gain of 6x at the expense of a very significant quality loss (at least on photographic images). A compression such as JPEG can give you a gain of 20x without losing nearly as much quality (in fact very little quality loss), and I think that even at 50x compression ratio it will still have better quality than any 4bpp BMP diethering. There is a number of JPEG libraries out there, some highly optimized (like INTEL's). I hope this helps, Rogério

        U 1 Reply Last reply
        0
        • R Rilhas

          My answer does not address your question directly, since a good answer has already been given. I just wanted to remind you that if you are doing this to conserve space you will only get a gain of 6x at the expense of a very significant quality loss (at least on photographic images). A compression such as JPEG can give you a gain of 20x without losing nearly as much quality (in fact very little quality loss), and I think that even at 50x compression ratio it will still have better quality than any 4bpp BMP diethering. There is a number of JPEG libraries out there, some highly optimized (like INTEL's). I hope this helps, Rogério

          U Offline
          U Offline
          User 12349108
          wrote on last edited by
          #4

          thanks: https://movied.org

          1 Reply Last reply
          0
          • R RabidHamster

            A simple, efficient, and effective solution is error diffusion. The idea is to find the error between the color you want and the color you can produce. You move that error into neighboring pixels. The error accumulates until it reaches the threshold for the next representable color. The effect is surprisingly good. The algorithm as documented is good for one dimension of color (monochrome). The full color spectrum has three dimensions, so you'll have to apply error diffusion on all three individually. Try it with the red, green, and blue values and see how it works out. If that doesn't look good enough, post again and I'll dig up my HLS color code.

            U Offline
            U Offline
            User 12349108
            wrote on last edited by
            #5

            thanks: https://movied.org

            1 Reply Last reply
            0
            • F FlytotheBluesky

              Hi! Please tell me about dithering algorithm clearly. I try to change color depth of bmp 24 bits to 4 bits, but my algorithm is not good...Then someone tell me about dithering, but not clearly, they don't give me an algorithm or clear idea but that's an introduction about dithering...So if you can, please tell me about dithering algorithm clearly. Thanks and waiting for your replies. Best regards, FlytotheBlueSky

              U Offline
              U Offline
              User 12349108
              wrote on last edited by
              #6

              thanks: https://movied.org

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups