Skip to content
Commit 0c420156 authored by Dmitry Chestnykh's avatar Dmitry Chestnykh
Browse files

image: use paletted image.

This simplifies code and makes it faster. It also produces smaller PNGs.

Before:

captcha.BenchmarkNewImage	500	 6198230 ns/op
captcha.BenchmarkImageWriteTo	100	17517110 ns/op   0.14 MB/s

After:

captcha.BenchmarkNewImage	500	 3869968 ns/op
captcha.BenchmarkImageWriteTo	200	 7237604 ns/op   0.23 MB/s

(Core 2 Duo @ 2.26 GHz, MacBook)

Currently the background is white, not transparent, because PNG encoder
doesn't support paletted images with alpha channel.

Submitted CL: http://codereview.appspot.com/4432078

Change alpha to 0x00 once it's accepted to make captcha transparent.
parent fe75d4b6
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment