Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laser-gcode-exporter-inkscape-plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
laser-gcode-exporter-inkscape-plugin
Commits
5b05452e
Commit
5b05452e
authored
May 17, 2016
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better options for color reduction
parent
bea41aef
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
turnkeylaser.py
turnkeylaser.py
+4
-0
No files found.
turnkeylaser.py
View file @
5b05452e
...
@@ -1033,8 +1033,12 @@ class Gcode_tools(inkex.Effect):
...
@@ -1033,8 +1033,12 @@ class Gcode_tools(inkex.Effect):
# dithering image and compile the pixels
# dithering image and compile the pixels
if
altcolorspace
==
0
:
if
altcolorspace
==
0
:
palette
=
list
(
set
(
img
.
convert
(
"P"
,
palette
=
Image
.
ADAPTIVE
,
colors
=
laserPower
-
1
)
.
getpalette
()))
palette
=
list
(
set
(
img
.
convert
(
"P"
,
palette
=
Image
.
ADAPTIVE
,
colors
=
laserPower
-
1
)
.
getpalette
()))
elif
altcolorspace
<=
2
:
palette
=
[
0
,
255
]
else
:
else
:
palette
=
list
(
set
(
img
.
convert
(
"P"
,
palette
=
Image
.
ADAPTIVE
,
colors
=
altcolorspace
-
1
)
.
getpalette
()))
palette
=
list
(
set
(
img
.
convert
(
"P"
,
palette
=
Image
.
ADAPTIVE
,
colors
=
altcolorspace
-
1
)
.
getpalette
()))
maxp
=
max
(
palette
)
palette
=
[
n
*
255
/
maxp
for
n
in
palette
]
inkex
.
errormsg
(
"reduce colorspace to "
+
str
(
len
(
palette
))
+
" colors palette..."
)
inkex
.
errormsg
(
"reduce colorspace to "
+
str
(
len
(
palette
))
+
" colors palette..."
)
if
altdither
:
if
altdither
:
inkex
.
errormsg
(
"dithering enabled"
)
inkex
.
errormsg
(
"dithering enabled"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment