55
66Average image colors in a pixel row until difference between averaged and next pixel in row reach threshold. Then repeat the same in column. Thus filter changes smooth image areas to completely flat colored, with detailed edges between them.
77
8- Input: PNG, PPM, PGM.
8+ Input: PNG, PPM, PGM, PBM .
99
10- Output: PNG, PPM.
10+ Output: PNG, PPM, PGM .
1111
1212Created by: `Ilya Razmanov<mailto:ilyarazmanov@gmail.com>`_ aka `Ilyich the Toad<mailto:amphisoft@gmail.com>`_.
1313
2424
25252.16.20.20 Changed GUI to menus.
2626
27- 3.20.6.8 Changed GUI to grid to fit all new features. More detailed image info; image edited/saved status displayed as "*" a-la Photoshop.
27+ 3.20.7.14 Changed GUI to grid to fit all new features. More detailed image info; image edited/saved status displayed as "*" a-la Photoshop.
2828
2929----
3030Main site: `The Toad's Slimy Mudhole<https://dnyarri.github.io>`_
3737__copyright__ = '(c) 2024-2025 Ilya Razmanov'
3838__credits__ = 'Ilya Razmanov'
3939__license__ = 'unlicense'
40- __version__ = '3.20.7.14 '
40+ __version__ = '3.20.8.10 '
4141__maintainer__ = 'Ilya Razmanov'
4242__email__ = 'ilyarazmanov@gmail.com'
4343__status__ = 'Production'
@@ -93,6 +93,7 @@ def UINormal() -> None:
9393 info_string .config (text = info_normal ['txt' ], foreground = info_normal ['fg' ], background = info_normal ['bg' ])
9494 if Z == 1 or Z == 3 :
9595 check02 ['state' ] = 'disabled'
96+ butt02 .focus_set ()
9697
9798
9899def UIBusy () -> None :
@@ -128,7 +129,7 @@ def ShowPreview(preview_name: PhotoImage, caption: str) -> None:
128129
129130def GetSource (event = None ) -> None :
130131 """Opening source image and redefining other controls state"""
131- global zoom_factor , view_src , is_filtered , is_saved , info_normal
132+ global zoom_factor , view_src , is_filtered , is_saved , info_normal , color_title
132133 global preview
133134 global X , Y , Z , maxcolors , image3D , info , sourcefilename
134135 global source_image3D , preview_src , preview_filtered # deep copy of source data and copies of preview
@@ -210,15 +211,25 @@ def GetSource(event=None) -> None:
210211 # ↓ updating zoom label display
211212 label_zoom ['text' ] = 'Zoom 1:1'
212213 # ↓ Adding filename to window title a-la Photoshop
213- sortir .title (f'Averager: { Path (sourcefilename ).name } { "*" if is_filtered else "" } ' )
214+ if Z == 1 :
215+ color_title = ' (L)'
216+ elif Z == 2 :
217+ color_title = ' (LA)'
218+ elif Z == 3 :
219+ color_title = ' (RGB)'
220+ elif Z == 4 :
221+ color_title = ' (RGBA)'
222+ else :
223+ color_title = ''
224+ sortir .title (f'Averager: { Path (sourcefilename ).name } { color_title } { "*" if is_filtered else "" } ' )
214225 info_normal = {'txt' : f'{ Path (sourcefilename ).name } { "*" if is_filtered else "" } X={ X } Y={ Y } Z={ Z } maxcolors={ maxcolors } ' , 'fg' : 'grey' , 'bg' : 'grey90' }
215226 # ↓ enabling "Filter"
216227 UINormal ()
217228
218229
219230def RunFilter (event = None ) -> None :
220231 """Filtering image, and previewing"""
221- global zoom_factor , view_src , is_filtered , is_saved , info_normal
232+ global zoom_factor , view_src , is_filtered , is_saved , info_normal , color_title
222233 global preview , preview_filtered
223234 global X , Y , Z , maxcolors , image3D , info
224235
@@ -258,7 +269,7 @@ def RunFilter(event=None) -> None:
258269 # ↓ binding switch on preview click
259270 zanyato .bind ('<Button-1>' , SwitchView ) # left click
260271 # ↓ Adding filename to window title a-la Photoshop
261- sortir .title (f'Averager: { Path (sourcefilename ).name } { "*" if is_filtered else "" } ' )
272+ sortir .title (f'Averager: { Path (sourcefilename ).name } { color_title } { "*" if is_filtered else "" } ' )
262273 info_normal = {'txt' : f'{ Path (sourcefilename ).name } { "*" if is_filtered else "" } X={ X } Y={ Y } Z={ Z } maxcolors={ maxcolors } ' , 'fg' : 'grey' , 'bg' : 'grey90' }
263274 UINormal ()
264275
@@ -319,7 +330,7 @@ def SwitchView(event=None) -> None:
319330
320331def Save (event = None ) -> None :
321332 """Once pressed on Save"""
322- global is_filtered , is_saved , info_normal
333+ global is_filtered , is_saved , info_normal , color_title
323334
324335 if is_saved : # block repetitive saving
325336 return
@@ -338,14 +349,14 @@ def Save(event=None) -> None:
338349 is_filtered = False
339350 menu02 .entryconfig ('Save' , state = 'disabled' )
340351 # ↓ Adding filename to window title a-la Photoshop
341- sortir .title (f'Averager: { Path (sourcefilename ).name } { "*" if is_filtered else "" } ' )
352+ sortir .title (f'Averager: { Path (sourcefilename ).name } { color_title } { "*" if is_filtered else "" } ' )
342353 info_normal = {'txt' : f'{ Path (sourcefilename ).name } { "*" if is_filtered else "" } X={ X } Y={ Y } Z={ Z } maxcolors={ maxcolors } ' , 'fg' : 'grey' , 'bg' : 'grey90' }
343354 UINormal ()
344355
345356
346357def SaveAs (event = None ) -> None :
347358 """Once pressed on Save as..."""
348- global sourcefilename , is_saved , is_filtered , info_normal
359+ global sourcefilename , is_saved , is_filtered , info_normal , color_title
349360
350361 # ↓ Adjusting "Save to" formats to be displayed according to bitdepth
351362 if Z < 3 :
@@ -374,7 +385,7 @@ def SaveAs(event=None) -> None:
374385 is_filtered = False
375386 menu02 .entryconfig ('Save' , state = 'disabled' )
376387 # ↓ Adding filename to window title a-la Photoshop
377- sortir .title (f'Averager: { Path (sourcefilename ).name } { "*" if is_filtered else "" } ' )
388+ sortir .title (f'Averager: { Path (sourcefilename ).name } { color_title } { "*" if is_filtered else "" } ' )
378389 info_normal = {'txt' : f'{ Path (sourcefilename ).name } { "*" if is_filtered else "" } X={ X } Y={ Y } Z={ Z } maxcolors={ maxcolors } ' , 'fg' : 'grey' , 'bg' : 'grey90' }
379390 UINormal ()
380391
@@ -397,6 +408,7 @@ def SaveAs(event=None) -> None:
397408# ↓ Info statuses dictionaries
398409info_normal = {'txt' : f'Adaptive Average { __version__ } ' , 'fg' : 'grey' , 'bg' : 'grey90' }
399410info_busy = {'txt' : 'BUSY, PLEASE WAIT' , 'fg' : 'red' , 'bg' : 'yellow' }
411+ color_title = ' '
400412
401413info_string = Label (sortir , text = info_normal ['txt' ], font = ('courier' , 7 ), foreground = info_normal ['fg' ], background = info_normal ['bg' ], relief = 'groove' )
402414info_string .pack (side = 'bottom' , padx = 0 , pady = (2 , 0 ), fill = 'both' )
@@ -431,6 +443,7 @@ def SaveAs(event=None) -> None:
431443menu02 .add_command (label = 'Exit' , state = 'normal' , command = DisMiss , accelerator = 'Ctrl+Q' )
432444
433445butt01 ['menu' ] = menu02
446+ butt01 .focus_set ()
434447
435448# ↓ Filter section begins
436449info00 = Label (frame_top , text = 'Filtering threshold:' , font = ('helvetica' , 8 , 'italic' ), justify = 'right' , foreground = 'brown' , state = 'disabled' )
0 commit comments