image2gcode 2.9.7__py3-none-any.whl → 2.9.9__py3-none-any.whl

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.
image2gcode/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  """
2
2
  image2gcode: convert an image to gcode.
3
3
  """
4
- __version__ = "2.9.7"
4
+ __version__ = "2.9.9"
image2gcode/__main__.py CHANGED
@@ -107,6 +107,7 @@ def main() -> int:
107
107
  type=int, help="maximum laser power while drawing (as a rule of thumb set to 1/3 of the maximum of a machine having a 5W laser)")
108
108
  parser.add_argument('--poweroffset', default=cfg["poweroffset_default"], metavar="<default:" +str(cfg["poweroffset_default"])+ ">",
109
109
  type=int, help="pixel intensity to laser power: shift power range [0-maxpower]")
110
+ parser.add_argument('--noinvert', action='store_true', default=False, help='do not invert the image' )
110
111
  parser.add_argument('--size', default=None, nargs=2, metavar=('gcode-width', 'gcode-height'),
111
112
  type=float, help="target gcode width and height in mm (default: not set and determined by pixelsize and image source resolution)")
112
113
  parser.add_argument('--offset', default=None, nargs=2, metavar=('X-off', 'Y-off'),
@@ -63,6 +63,12 @@ class Boundingbox:
63
63
  return ( point.x >= self._bbox.lowerleft.x and point.y >= self._bbox.lowerleft.y
64
64
  and point.x <= self._bbox.upperright.x and point.y <= self._bbox.upperright.y )
65
65
 
66
+ def size(self) -> float:
67
+ """
68
+ get bounding box size
69
+ """
70
+ return (self._bbox.upperright.x - self._bbox.lowerleft.x) * (self._bbox.upperright.y - self._bbox.lowerleft.y)
71
+
66
72
  if __name__ == '__main__':
67
73
  p = Point(0,0)
68
74
  print(f"type: {type(p)}")
@@ -27,7 +27,7 @@ class Image2gcode:
27
27
  Class Image2gcode handles the conversion of an image to gcode.
28
28
  """
29
29
 
30
- def __init__(self, power: Callable[[UInt8,int,bool],int] = None,
30
+ def __init__(self, power: Callable[[UInt8,int,int,bool],int] = None,
31
31
  transformation: Callable[[Tuple[float,float]],Tuple[float,float]] = None):
32
32
 
33
33
  # init
@@ -243,7 +243,7 @@ class Image2gcode:
243
243
 
244
244
  # draw this pixel line
245
245
  for count, pixel in enumerate(line):
246
- laserpow = self._power(pixel, args["maxpower"], args["poweroffset"])
246
+ laserpow = self._power(pixel, args["maxpower"], args["poweroffset"], not args["noinvert"])
247
247
 
248
248
  if count == 0:
249
249
  # delay emit first pixel (so all same power pixels can be emitted in one sweep)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: image2gcode
3
- Version: 2.9.7
3
+ Version: 2.9.9
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>
@@ -35,7 +35,7 @@ If this is too cumbersome, use option --size (release 2.5.0 or above), also for
35
35
 
36
36
  Some people noticed incorrect low burn levels at the edges of objects within an image, this can be remedied by using option '--overscan <nbr of pixels>'. This makes sure the laser head will continue for a few pixels on a line after the last non empty pixel, or start the head a few pixels before the first non empty pixel is written on a line.
37
37
 
38
- It is possible to calibrate your laser machine now: option ```--genimages pixel-width pixel-height write``` generates a set calibration files that can be used as input for ```image2gcode``` to experiment with settings like ```--pixelsize```, ```--speed and ```--maxpower``` to get the right setup! For example use ```image2gcode --showimage --genimages 200 200 0``` to generate test images of 200 by 200 pixels that show up in the viewer (but are not written to the file system). See chapter *calibrate* below.
38
+ It is possible to calibrate your laser machine now: option ```--genimages pixel-width pixel-height write``` generates a set calibration files that can be used as input for ```image2gcode``` to experiment with settings like ```--pixelsize```, ```--speed``` and ```--maxpower``` to get the right setup! For example use ```image2gcode --showimage --genimages 200 200 0``` to generate test images of 200 by 200 pixels that show up in the viewer (but are not written to the file system). See chapter *calibrate* below.
39
39
 
40
40
  Please consider supporting me, so I can make this application better and add new functionality to it: <http://paypal.me/johannesnoordanus/5,00>
41
41
 
@@ -107,6 +107,7 @@ options:
107
107
  maximum laser power while drawing (as a rule of thumb set to 1/3 of the maximum of a machine having a 5W laser)
108
108
  --poweroffset <default:0>
109
109
  pixel intensity to laser power: shift power range [0-maxpower]
110
+ --noinvert do not invert the image
110
111
  --size gcode-width gcode-height
111
112
  target gcode width and height in mm (default: not set and determined by pixelsize and image source resolution)
112
113
  --offset X-off Y-off laser drawing starts at offset in mm (default not set, --center cannot be set at the same time)
@@ -0,0 +1,11 @@
1
+ image2gcode/__init__.py,sha256=JOs9uyxIqbN39WNhOi7Cm1cIZ29j1CaizKVIHPRR8tc,70
2
+ image2gcode/__main__.py,sha256=gPgLxy7HhCbtS_V7Yzl5Z0z63JCTSH3I1jJaBYz5vwQ,10063
3
+ image2gcode/boundingbox.py,sha256=862ZKdoBARd10can3IKnJaJW7HbcU4JxGNy-2itE9-c,3250
4
+ image2gcode/image2gcode.py,sha256=uoEW4uj-gO6k4U_sTsV_1I5n8P5BlLtg2YqWoYLO7xw,13069
5
+ image2gcode/imagegen.py,sha256=my2kBHoMq1kjnDKTQ_L-f4ymwmXJSCyhxqZ5dFzhRwc,14270
6
+ image2gcode/newimage2gcode.py,sha256=lQCWvZatuiaCE2kv8sxSA-4dYlIZNfO9iFNfXxjDShs,13043
7
+ image2gcode-2.9.9.dist-info/entry_points.txt,sha256=j5b4eYXSOUdPSgAydKBbAWUbkow4iEvV1DMfNi77B9E,57
8
+ image2gcode-2.9.9.dist-info/LICENSE,sha256=ghSxQl_EUJUTiu712NkZkroJHvgOrR0j4CddAq8Y7Tc,1085
9
+ image2gcode-2.9.9.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
10
+ image2gcode-2.9.9.dist-info/METADATA,sha256=nQdMOPSWc6_l36h9fiVPRil5cYUr5-gI73Khyu2fdFI,12471
11
+ image2gcode-2.9.9.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- image2gcode/__init__.py,sha256=aaKoaHjem8g7BUimSAIEUkIgm-NBgxtutTYwPHIqhtM,70
2
- image2gcode/__main__.py,sha256=KcgeCEZIOTgph9VVheS2EkxFBIeCcSlQ4a30fCYRBCc,9956
3
- image2gcode/boundingbox.py,sha256=qSUufnzpSpcrCbtBp0P9FHov6dRYQmYeFvdxgKYNtb0,3047
4
- image2gcode/image2gcode.py,sha256=lQCWvZatuiaCE2kv8sxSA-4dYlIZNfO9iFNfXxjDShs,13043
5
- image2gcode/imagegen.py,sha256=my2kBHoMq1kjnDKTQ_L-f4ymwmXJSCyhxqZ5dFzhRwc,14270
6
- image2gcode/newimage2gcode.py,sha256=lQCWvZatuiaCE2kv8sxSA-4dYlIZNfO9iFNfXxjDShs,13043
7
- image2gcode-2.9.7.dist-info/entry_points.txt,sha256=j5b4eYXSOUdPSgAydKBbAWUbkow4iEvV1DMfNi77B9E,57
8
- image2gcode-2.9.7.dist-info/LICENSE,sha256=ghSxQl_EUJUTiu712NkZkroJHvgOrR0j4CddAq8Y7Tc,1085
9
- image2gcode-2.9.7.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
10
- image2gcode-2.9.7.dist-info/METADATA,sha256=Kh_eXr24Daf5Es6CVu9AMR9EtylKN5oIuHZAU7ASFlQ,12420
11
- image2gcode-2.9.7.dist-info/RECORD,,