cross-stitch

Interactively turn images into patterns for cross stitching
git clone git://src.adamsgaard.dk/cross-stitch
Log | Files | Refs

commit 3244a052b16127ff038b8807e0bf19598eb6a05d
parent 35a43e65034c9ad4fbd06132c518970b3cac7c2a
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date:   Sat, 15 Feb 2014 22:12:29 +0100

256 color conversion working

Diffstat:
Mcross-stitch.py | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/cross-stitch.py b/cross-stitch.py @@ -18,7 +18,6 @@ class Palette: def __init__(self, type='256colors'): if type == '256colors': self.rgblist = numpy.loadtxt('./256-color-rgb.dat') - print(self.rgblist.shape) def nearest256color(self, rgbval): ibest = -1 @@ -67,7 +66,7 @@ class CrossStitch: palette = Palette('256colors') tmp = self.img.reshape(scipy.product(self.img.shape[:2]),\ self.img.shape[2]) - for i in range(tmp.size): + for i in range(tmp.size/3): tmp[i] = palette.nearest256color(tmp[i]) self.img = tmp.reshape(self.img.shape[0], self.img.shape[1], 3) @@ -123,7 +122,7 @@ class MainScreen(wx.Frame): 'Reduce number of colors in image') self.Bind(wx.EVT_MENU, self.OnLimitColors, fitem) fitem = processingMenu.Append(wx.ID_ANY,\ - 'Reduce to standard 256 colors',\ + 'Reduce to standard 256 colors (slow)',\ 'Reduce number of colors in image to the standard 256 colors') self.Bind(wx.EVT_MENU, self.On256Colors, fitem) menubar.Append(processingMenu, '&Image processing')