Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1702)

Issue 4956046: image: PalettedColor added. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 7 months ago by jp
Modified:
13 years, 7 months ago
Reviewers:
CC:
golang-dev, rsc, bradfitz, nigeltao
Visibility:
Public.

Description

image: PalettedColor added. Motivation: image.Image interface is very abstract and useful not only to access in-memory images, but also on-disk images (think tiled geotiff and images to big to load them into memory) Currently the only way to access color indices of paletted image is in-memory image.Paletted. As a consequence, the present png.Encode() can encode paletted image only from this in-memory source, but not from any Image whose ColorModel() is image.PalettedColorModel Introduced image.PalettedColor encapsulates color index and palette slice. This allows to calc RGBA color quickly and also does not loose its color index in the palette. Storing color index is useful for operations which preserve palette, such as taking image slice or converting image from one file format to another. Also, PNG Writer changed to be more generic and to work with on-disk paletted images as the source.

Patch Set 1 #

Patch Set 2 : diff -r 5e1053337103 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 5e1053337103 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r db63f3a1f992 https://go.googlecode.com/hg/ #

Total comments: 3

Patch Set 5 : diff -r 688881c38f0d https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+32 lines, -6 lines) Patch
M src/pkg/image/image.go View 1 2 3 4 2 chunks +14 lines, -0 lines 0 comments Download
M src/pkg/image/png/writer.go View 1 2 3 4 3 chunks +18 lines, -6 lines 0 comments Download

Messages

Total messages: 16
jp
13 years, 7 months ago (2011-08-28 02:39:32 UTC) #1
rsc
Can you benchmark paletted image encoding before and after this change? I think you will ...
13 years, 7 months ago (2011-08-28 15:55:24 UTC) #2
jp
On 2011/08/28 15:55:24, rsc wrote: > Can you benchmark paletted image encoding > before and ...
13 years, 7 months ago (2011-08-28 17:01:24 UTC) #3
jp
Also, please have a look at the code png/writer.go around my patch. using copy() there ...
13 years, 7 months ago (2011-08-28 17:32:18 UTC) #4
bradfitz
So is it faster or slower now? There are plenty of existing benchmarks you copy/paste ...
13 years, 7 months ago (2011-08-28 20:33:47 UTC) #5
jp
On 2011/08/28 20:33:47, bradfitz wrote: Slower, about 7x. I made the change in order not ...
13 years, 7 months ago (2011-08-28 21:30:11 UTC) #6
nigeltao
On 28 August 2011 12:39, <jp@webmaster.ms> wrote: > Description: > image: PalettedColor added. I'm happy ...
13 years, 7 months ago (2011-08-29 00:31:12 UTC) #7
jp
On 2011/08/29 00:31:12, nigeltao wrote: > On 28 August 2011 12:39, <mailto:jp@webmaster.ms> wrote: > > ...
13 years, 7 months ago (2011-08-29 01:28:53 UTC) #8
jp
I meant zerocopy image converters, like below With PalettedImage they will lose color index information ...
13 years, 7 months ago (2011-08-29 01:49:35 UTC) #9
nigeltao
On 29 August 2011 11:28, <jp@webmaster.ms> wrote: >> I'm happy to broaden the types of ...
13 years, 7 months ago (2011-08-29 04:35:08 UTC) #10
jp
It results in almost every code which works with image.Image will check it for image.PalettedImage. ...
13 years, 7 months ago (2011-08-29 05:28:15 UTC) #11
jp
PTAL On 2011/08/29 05:28:15, jp wrote: > It results in almost every code which works ...
13 years, 7 months ago (2011-08-30 06:07:24 UTC) #12
nigeltao
http://codereview.appspot.com/4956046/diff/15001/src/pkg/image/image.go File src/pkg/image/image.go (right): http://codereview.appspot.com/4956046/diff/15001/src/pkg/image/image.go#newcode27 src/pkg/image/image.go:27: // Image is PalettedImage iff its ColorModel() is PalettedColorModel ...
13 years, 7 months ago (2011-08-30 07:52:03 UTC) #13
jp
PTAL On 2011/08/30 07:52:03, nigeltao wrote: > http://codereview.appspot.com/4956046/diff/15001/src/pkg/image/image.go > File src/pkg/image/image.go (right): > > http://codereview.appspot.com/4956046/diff/15001/src/pkg/image/image.go#newcode27 ...
13 years, 7 months ago (2011-08-30 20:47:38 UTC) #14
nigeltao
On 31 August 2011 06:47, <jp@webmaster.ms> wrote: > PTAL LGTM, thanks.
13 years, 7 months ago (2011-08-30 22:26:54 UTC) #15
nigeltao
13 years, 7 months ago (2011-08-30 22:27:09 UTC) #16
*** Submitted as http://code.google.com/p/go/source/detail?r=070b7cc84e48 ***

image: add PalettedImage interface, and make image/png recognize it.

R=golang-dev, rsc, bradfitz, nigeltao
CC=golang-dev
http://codereview.appspot.com/4956046

Committer: Nigel Tao <nigeltao@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b