Android Code Snippet LoRes PNG

SubName: LoResPNG

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

Code: See attached Zip file

Dependencies: BitmapExtended

Tags: PNG


Hello:

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.png

GolfScoreRound-16Colors is the reduced file - 36,488 bytes
GolfScoreRound-16Colors.png


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 LoResPNG.zip file

Hope this helps someone out.

Enjoy

BobVal
 

Attachments

  • LoResPNG.zip
    89.6 KB · Views: 327
Last edited:

Harris

Expert
Licensed User
Longtime User
gp2.jpg
gp1.jpg


Interesting....

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....
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Yeah, they are kind of a drag even today.
They own GHIN.com 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.
 
Top