image2gcode 1.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: image2gcode
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: image2gcode: convert an image to gcode.
5
5
  Keywords: engraving,laser,image,laser engraving,PWM,gcode
6
6
  Author-email: Johannes Noordanus <mailjohannes.mailnoordanus@gmail.com>
@@ -2,7 +2,7 @@
2
2
  """
3
3
  image2gcode: convert an image to gcode.
4
4
  """
5
- __version__ = "1.1.0"
5
+ __version__ = "1.2.0"
6
6
 
7
7
  import sys
8
8
  import argparse
@@ -176,7 +176,8 @@ def main() -> int:
176
176
  sys.exit(1)
177
177
 
178
178
  # load and convert image to B&W
179
- narr = loadImage(args.image.name,args.showimage)
179
+ # flip image updown because Gcode and raster image coordinate system differ
180
+ narr = np.flipud(loadImage(args.image.name,args.showimage))
180
181
 
181
182
  print('Area: ' + str(round(narr.shape[1] * args.pixelsize,2)) + "mm x " + str(round(narr.shape[0] * args.pixelsize,2)) + "mm (XY)")
182
183
  print('> pixelsize', args.pixelsize, 'mm^2, speed', args.speed, 'mm/min, maxpower ' + str(args.maxpower) + ', offset', args.offset)
@@ -187,8 +188,8 @@ def main() -> int:
187
188
  if args.validate:
188
189
  args.gcode.close()
189
190
  with open(args.gcode.name, "r") as fgcode:
190
- #img = gcode2image(fgcode, narr.shape, args)
191
- img = gcode2image(Namespace(gcode = fgcode, offset = False, showG0 = True, grid = False))
191
+ # flip to raster image coordinate system
192
+ img = np.flipud(gcode2image(Namespace(gcode = fgcode, offset = False, showG0 = True, grid = False)))
192
193
 
193
194
  # convert to image
194
195
  img = Image.fromarray(img)
File without changes
File without changes
File without changes