imgtrans

Interactive BMP to txt converter
git clone git://src.adamsgaard.dk/imgtrans
Log | Files | Refs

commit 0a0ddf2b0c137448256dd2b7ac8cfe500cf389ef
parent 407219b622fbd5319afd61f39dc1e559dc8b4e33
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date:   Wed, 13 May 2015 08:54:53 +0200

update title and output

Diffstat:
Mimgtrans.py | 21++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/imgtrans.py b/imgtrans.py @@ -15,7 +15,7 @@ import matplotlib.pyplot import wx -class CrossStitch: +class ImgTrans: def __init__(self): self.img = numpy.zeros(3) @@ -58,7 +58,11 @@ class CrossStitch: matplotlib.pyplot.savefig(filename) def save_txt_file(self, filename): - numpy.savetxt(filename, self.img[:,:,0]/255., fmt='%20.18f') + numpy.savetxt(filename, + (self.img[:,:,0] + self.img[:,:,1] + self.img[:,:,2])/(3.*255.), + header='{:d} {:d}'.format(self.img.shape[0], self.img.shape[1]), + comments='', + fmt='%20.18f') def image(self): return self.img @@ -68,7 +72,7 @@ class MainScreen(wx.Frame): def __init__(self, *args, **kwargs): super(MainScreen, self).__init__(*args, **kwargs) - self.cs = CrossStitch() + self.cs = ImgTrans() self.InitUI() self.contentNotSaved = False self.grid = True @@ -209,26 +213,25 @@ class MainScreen(wx.Frame): def OnAbout(self, event): - description = '''ImgTrans is a raster pattern converter for Linux, -Mac OS X, and Windows. ''' + description = '''ImgTrans is a image converter.''' license = '''ImgTrans is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. -Cross Stitch is distributed in the hope that it will be useful, but WITHOUT ANY +ImgTrans is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have recieved a -copy of the GNU General Public License along with Cross Stitch; if not, write to +copy of the GNU General Public License along with ImgTrans; if not, write to the Free Software Foundation, Inc., 59 Temple Palace, Suite 330, Boston, MA 02111-1307 USA''' info = wx.AboutDialogInfo() info.SetIcon(wx.Icon('icon.png', wx.BITMAP_TYPE_PNG)) - info.SetName('Cross Stitch') + info.SetName('ImgTrans') info.SetVersion('1.0') info.SetDescription(description) info.SetCopyright('(C) 2015 Anders Damsgaard') @@ -244,7 +247,7 @@ the Free Software Foundation, Inc., 59 Temple Palace, Suite 330, Boston, MA def main(): app = wx.App() - MainScreen(None, title='Cross Stitch') + MainScreen(None, title='ImgTrans') app.MainLoop() if __name__ == '__main__':