06-10-2023, 07:23 AM
(06-10-2023, 12:38 AM)jacques_duflos Wrote: I made it with chatgpt, it's the first time I use it to program, and I'm impressed.
Me, somewhat less so... looks like the intern's code
- glob.glob() does the filtering and returns the list of files with full paths: for instance glob.glob('Screenshots/*.png') returns ['Screenshots/OldStyle.png', 'Screenshots/MapObjectPlaneAxis.png'] and this would avoid some file name tinkering
- duplicating the image is somewhat wasteful, saving the result of a layer-new-from-visible is sufficient: pdb.gimp_file_save(image, pdb.gimp_layer_new_from_visible(image, image, "## saved"), '/tmp/foo.png','/tmp/foo.png')
- catching an exception to bury it with a pass is heinous. Good luck if you can't create the directory.