My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

splitIco.py 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env python3
  2. #
  3. # Split a DWIN .ico file into separate images.
  4. #
  5. # Copyright (c) 2020 Brent Burton
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. #----------------------------------------------------------------
  20. import os.path
  21. import argparse
  22. import DWIN_ICO
  23. version = '2.0.7'
  24. #----------------
  25. if __name__ == '__main__':
  26. try:
  27. parser = argparse.ArgumentParser(description='Split .ico into JPEG files')
  28. parser.add_argument('filename', type=str, nargs=1,
  29. help='name of input .ico file to split')
  30. parser.add_argument('outputDir', type=str, nargs=1,
  31. help='name of output directory to create')
  32. args = parser.parse_args()
  33. filename = args.filename[0]
  34. outputDir = args.outputDir[0]
  35. if not os.path.isfile(filename):
  36. raise RuntimeError("ICO file '%s' doesn't exist" % (filename))
  37. if os.path.exists(outputDir):
  38. raise RuntimeError("Output directory '%s' already exists." % (outputDir))
  39. print('Splitting %s into dir %s' % (filename, outputDir))
  40. ico = DWIN_ICO.DWIN_ICO_File()
  41. ico.splitFile(filename, outputDir)
  42. except Exception as e:
  43. print('Error: ', e)