Android Code Snippet LoRes PNG

Discussion in 'Code Snippets' started by Robert Valentino, May 7, 2015.

  1. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    SubName: LoResPNG

    Description: Make PNG files smaller by limiting the colors in them

    Code: See attached Zip file

    Dependencies: BitmapExtended

    Tags: PNG


    For some time I have been trying to make PNG files I write out a little smaller.

    By smaller I mean from 80k to less than 50k.

    Now I know a lot of you will think this is not worth doing but my golf program tends to be used more in Rural areas where 1x is more common than 3x. So saving 40k in a file to be Emailed is a big.

    Playing around with PNG files I came up with a way of changing some of the color bytes and still keep the quality worth looking at. I use BitmapExtended to reduce the bitmap size by 50% which takes the file from around 125K to the 82K and then I run my LoResPNG software on it.

    Here are the results before and after LoResPNG:

    GolfScoreRound is the original file - 82,178 bytes
    GolfScoreRound-16Colors is the reduced file - 36,488 bytes

    I have also tried 8 colors to save a little more but gets a tad darker then I would like

    I have done EVERYTHING I could think of to try and make performance good. In fact I fine how much savings there are compared to how LITTLE time it takes to be more than worth while

    Attached is the file

    Hope this helps someone out.



    Attached Files:

    Last edited: May 7, 2015
  2. Harris

    Harris Well-Known Member Licensed User

    gp2.jpg gp1.jpg


    Back in the late 80's - I wrote this system.
    USGA shut us down because it was infringing on their Slope system.

    Them were the days....
  3. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    Yeah, they are kind of a drag even today.
    They own and will not even answer any Emails about an API to update the Advanced stats. Driving Distance, Putts per hole, etc.

    But this is probably not a place for this topic.

    Looks like you had a nice product.
    Harris likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice