adding back several more extensions
This commit is contained in:
21
extensions/fablabchemnitz/output_pro/meta.json
Normal file
21
extensions/fablabchemnitz/output_pro/meta.json
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"name": "Inkscape Output Pro",
|
||||
"id": "fablabchemnitz.de.output_pro",
|
||||
"path": "output_pro",
|
||||
"dependent_extensions": null,
|
||||
"original_name": "Inkscape Output Pro",
|
||||
"original_id": "org.inkscape.outputpro",
|
||||
"license": "GNU GPL v2",
|
||||
"license_url": "https://github.com/jonata/Inkscape-OUTPUT-PRO/blob/master/LICENSE.txt",
|
||||
"comment": "ported to Inkscape v1 by Mario Voigt",
|
||||
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/output_pro",
|
||||
"fork_url": "https://github.com/jonata/Inkscape-OUTPUT-PRO",
|
||||
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Output+Pro+for+Inkscape",
|
||||
"inkscape_gallery_url": null,
|
||||
"main_authors": [
|
||||
"github.com/jonata",
|
||||
"github.com/eridur-de"
|
||||
]
|
||||
}
|
||||
]
|
16
extensions/fablabchemnitz/output_pro/output_pro.inx
Normal file
16
extensions/fablabchemnitz/output_pro/output_pro.inx
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<name>Inkscape Output Pro</name>
|
||||
<id>fablabchemnitz.de.output_pro</id>
|
||||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu name="FabLab Chemnitz">
|
||||
<submenu name="Import/Export/Transfer"/>
|
||||
</submenu>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command location="inx" interpreter="python">output_pro.py</command>
|
||||
</script>
|
||||
</inkscape-extension>
|
1091
extensions/fablabchemnitz/output_pro/output_pro.py
Normal file
1091
extensions/fablabchemnitz/output_pro/output_pro.py
Normal file
File diff suppressed because it is too large
Load Diff
BIN
extensions/fablabchemnitz/output_pro/outputpro/alpha.png
Normal file
BIN
extensions/fablabchemnitz/output_pro/outputpro/alpha.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 170 B |
118
extensions/fablabchemnitz/output_pro/outputpro/cmyk.py
Normal file
118
extensions/fablabchemnitz/output_pro/outputpro/cmyk.py
Normal file
@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import re
|
||||
import os
|
||||
import inkex
|
||||
from inkex.command import inkscape
|
||||
|
||||
def calculateCMYK(red, green, blue):
|
||||
C = float()
|
||||
M = float()
|
||||
Y = float()
|
||||
K = float()
|
||||
|
||||
if 1.00 - red < 1.00 - green:
|
||||
K = 1.00 - red
|
||||
else:
|
||||
K = 1.00 - green
|
||||
|
||||
if 1.00 - blue < K:
|
||||
K = 1.00 - blue
|
||||
|
||||
if K != 1.00:
|
||||
C = ( 1.00 - red - K ) / ( 1.00 - K )
|
||||
M = ( 1.00 - green - K ) / ( 1.00 - K )
|
||||
Y = ( 1.00 - blue - K ) / ( 1.00 - K )
|
||||
|
||||
return [C, M, Y, K]
|
||||
|
||||
def clean_svg_color_definitions(svg):
|
||||
def change_colors(origin, color_type):
|
||||
for i in range(len(str(origin).split(color_type + ':'))):
|
||||
if str(str(origin).split(color_type + ':')[i].split(';')[0]) in inkex.colors.SVG_COLOR.keys():
|
||||
color_numbers = str(inkex.Color(inkex.Color(str(str(origin).split(color_type + ':')[i].split(';')[0])).to_rgb()))
|
||||
origin = str(origin).replace(':' + str(str(origin).split(color_type + ':')[i].split(';')[0]) + ';', ':' + color_numbers + ';')
|
||||
return origin
|
||||
|
||||
colortypes = ['fill', 'stop-color', 'flood-color', 'lighting-color', 'stroke']
|
||||
for i in range(len(colortypes)):
|
||||
svg = change_colors(svg, colortypes[i])
|
||||
|
||||
return svg
|
||||
|
||||
def removeK(origin):
|
||||
def reset_opacity(value):
|
||||
return str(value.group()).split('opacity:')[0] + "opacity:0;"
|
||||
#return re.sub("#000000;fill-opacity:[0-9.]+;", reset_opacity, re.sub("#000000;stop-opacity:[0-9.]+;", reset_opacity, re.sub("#000000;stroke-opacity:[0-9.]+;", reset_opacity, re.sub("#000000;flood-opacity:[0-9.]+;", reset_opacity, re.sub("#000000;lighting-opacity:[0-9.]+;", reset_opacity, origin)))))
|
||||
return re.sub("#000000;fill-opacity:[0-9.?]+", reset_opacity, re.sub("#000000;stop-opacity:[0-9.?]+", reset_opacity, re.sub("#000000;stroke-opacity:[0-9.?]+", reset_opacity, re.sub("#000000;flood-opacity:[0-9.?]+", reset_opacity, re.sub("#000000;lighting-opacity:[0-9.?]+", reset_opacity, origin)))))
|
||||
|
||||
def representC(value):
|
||||
# returns CMS color if available
|
||||
if (re.search("icc-color", value.group())):
|
||||
return str(inkex.Color((float(1.00 - float(re.split(r'[,\)\s]+',value.group())[2])), float(1.00), float(1.00))))
|
||||
else:
|
||||
red = float(inkex.Color(str(value.group())).to_rgb()[0]/255.00)
|
||||
green = float(inkex.Color(str(value.group())).to_rgb()[1]/255.00)
|
||||
blue = float(inkex.Color(str(value.group())).to_rgb()[2]/255.00)
|
||||
return str(inkex.Color((float(1.00 - calculateCMYK(red, green, blue)[0]), float(1.00), float(1.00))))
|
||||
|
||||
def representM(value):
|
||||
# returns CMS color if available
|
||||
if ( re.search("icc-color", value.group()) ):
|
||||
return str(inkex.Color((float(1.00), float(1.00 - float(re.split(r'[,\)\s]+',value.group())[3])), float(1.00))))
|
||||
else:
|
||||
red = float(inkex.Color(str(value.group())).to_rgb()[0]/255.00)
|
||||
green = float(inkex.Color(str(value.group())).to_rgb()[1]/255.00)
|
||||
blue = float(inkex.Color(str(value.group())).to_rgb()[2]/255.00)
|
||||
return str(inkex.Color((float(1.00), float(1.00 - calculateCMYK(red, green, blue)[1]), float(1.00))))
|
||||
|
||||
def representY(value):
|
||||
# returns CMS color if available
|
||||
if (re.search("icc-color", value.group()) ):
|
||||
return str(inkex.Color((float(1.00), float(1.00), float(1.00 - float(re.split(r'[,\)\s]+',value.group())[4])))))
|
||||
else:
|
||||
red = float(inkex.Color(str(value.group())).to_rgb()[0]/255.00)
|
||||
green = float(inkex.Color(str(value.group())).to_rgb()[1]/255.00)
|
||||
blue = float(inkex.Color(str(value.group())).to_rgb()[2]/255.00)
|
||||
return str(inkex.Color((float(1.00), float(1.00), float(1.00 - calculateCMYK(red, green, blue)[2]))))
|
||||
|
||||
def representK(value):
|
||||
# returns CMS color if available
|
||||
if (re.search("icc-color", value.group()) ):
|
||||
return str(inkex.Color((float(1.00 - float(re.split(r'[,\)\s]+',value.group())[5])), float(1.00 - float(re.split(r'[,\)\s]+',value.group())[5])), float(1.00 - float(re.split(r'[,\)\s]+',value.group())[5])))))
|
||||
else:
|
||||
red = float(inkex.Color(str(value.group())).to_rgb()[0]/255.00)
|
||||
green = float(inkex.Color(str(value.group())).to_rgb()[1]/255.00)
|
||||
blue = float(inkex.Color(str(value.group())).to_rgb()[2]/255.00)
|
||||
return str(inkex.Color((float(1.00 - calculateCMYK(red, green, blue)[3]), float(1.00 - calculateCMYK(red, green, blue)[3]), float(1.00 - calculateCMYK(red, green, blue)[3]))))
|
||||
|
||||
|
||||
def generate_svg_separations(temp_dir, original_source, overblack):
|
||||
svg_ready = clean_svg_color_definitions(original_source)
|
||||
|
||||
with open(os.path.join(temp_dir, "separationK.svg"), "w") as f:
|
||||
f.write(re.sub(r"#[a-fA-F0-9]{6}( icc-color\(.*?\))?", representK, svg_ready))
|
||||
|
||||
if overblack:
|
||||
svg_ready = removeK(svg_ready)
|
||||
|
||||
with open(os.path.join(temp_dir, "separationC.svg"), "w") as f:
|
||||
f.write(re.sub(r"#[a-fA-F0-9]{6}( icc-color\(.*?\))?", representC, svg_ready))
|
||||
with open(os.path.join(temp_dir, "separationM.svg"), "w") as f:
|
||||
f.write(re.sub(r"#[a-fA-F0-9]{6}( icc-color\(.*?\))?", representM, svg_ready))
|
||||
with open(os.path.join(temp_dir, "separationY.svg"), "w") as f:
|
||||
f.write(re.sub(r"#[a-fA-F0-9]{6}( icc-color\(.*?\))?", representY, svg_ready))
|
||||
|
||||
def generate_png_separations(temp_dir, area_to_export, resolution, alpha):
|
||||
if alpha:
|
||||
alpha_command = ""
|
||||
else:
|
||||
alpha_command = ";export-background:white"
|
||||
for color in ['C', 'M', 'Y', 'K']:
|
||||
cmd = area_to_export + alpha_command + ';export-dpi:' + str(resolution) + ';export-background-opacity:1;export-filename:' + os.path.join(temp_dir, "separated" + area_to_export.replace(' ', '') + color + ".png") + ';export-do'
|
||||
#inkex.utils.debug(cmd)
|
||||
cli_output = inkscape(os.path.join(temp_dir, "separation" + color + ".svg"), actions=cmd)
|
||||
if len(cli_output) > 0:
|
||||
inkex.utils.debug(cli_output)
|
||||
#inkex.utils.debug(os.listdir(temp_dir))
|
||||
|
84
extensions/fablabchemnitz/output_pro/outputpro/cutmarks.py
Normal file
84
extensions/fablabchemnitz/output_pro/outputpro/cutmarks.py
Normal file
@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
def generate_final_file(isvector, hide_inside_marks, colormode, width, height, space, strokewidth, bleedsize, marksize, temp_dir):
|
||||
if not isvector:
|
||||
|
||||
if "nt" in os.name:
|
||||
shell = True
|
||||
else:
|
||||
shell = False
|
||||
|
||||
command = []
|
||||
final_command = ['convert']
|
||||
|
||||
for color in colormode:
|
||||
command.append('convert')
|
||||
command.append('-size')
|
||||
command.append(str(sum(width) + (marksize*2) + (space * (len(width) -1))) + 'x' + str(sum(height) + (marksize*2) + (space * (len(height) -1))))
|
||||
command.append('xc:white')
|
||||
command.append('-stroke')
|
||||
command.append('black')
|
||||
command.append('-strokewidth')
|
||||
command.append(str(strokewidth))
|
||||
|
||||
width_value = 0
|
||||
number_of_column = 1
|
||||
|
||||
for column in width:
|
||||
height_value = 0
|
||||
number_of_line = 1
|
||||
|
||||
for line in height:
|
||||
with open(os.path.join(temp_dir, 'str.txt'), 'a') as f:
|
||||
f.write(str(width.index(column)))
|
||||
|
||||
if not hide_inside_marks or (hide_inside_marks and number_of_column == 1):
|
||||
command.append('-draw')
|
||||
command.append('line ' + str(width_value + marksize) + ',' + str(height_value + marksize + bleedsize) + ', ' + str(width_value) + ',' + str(height_value + marksize + bleedsize))
|
||||
command.append('-draw')
|
||||
command.append('line ' + str(width_value + marksize) + ',' + str(height_value + line + marksize - bleedsize) + ', ' + str(width_value) + ',' + str(height_value + line + marksize - bleedsize))
|
||||
|
||||
if not hide_inside_marks or (hide_inside_marks and number_of_line == 1):
|
||||
command.append('-draw')
|
||||
command.append('line ' + str(width_value + marksize + bleedsize) + ',' + str(height_value + marksize) + ', ' + str(width_value + marksize + bleedsize) + ',' + str(height_value))
|
||||
command.append('-draw')
|
||||
command.append('line ' + str(width_value + column + marksize - bleedsize) + ',' + str(height_value + marksize) + ', ' + str(width_value + column + marksize - bleedsize) + ',' + str(height_value))
|
||||
|
||||
if not hide_inside_marks or (hide_inside_marks and number_of_column == len(width)):
|
||||
command.append('-draw')
|
||||
command.append('line ' + str(width_value + marksize + column) + ',' + str(height_value + marksize + bleedsize) + ', ' + str(width_value + (marksize*2) + column) + ',' + str(height_value + marksize + bleedsize))
|
||||
command.append('-draw')
|
||||
command.append('line ' + str(width_value + marksize + column) + ',' + str(height_value + line + marksize - bleedsize) + ', ' + str(width_value + (marksize*2) + column) + ',' + str(height_value + marksize + line - bleedsize))
|
||||
|
||||
if not hide_inside_marks or (hide_inside_marks and number_of_line == len(height)):
|
||||
command.append('-draw')
|
||||
command.append('line ' + str(width_value + marksize + bleedsize) + ',' + str(height_value + line + marksize) + ', ' + str(width_value + marksize + bleedsize) + ',' + str(height_value + line + (marksize*2)))
|
||||
command.append('-draw')
|
||||
command.append('line ' + str(width_value + column + marksize - bleedsize) + ',' + str(height_value + line + marksize) + ', ' + str(width_value + marksize + column - bleedsize) + ',' + str(height_value + line + (marksize*2)))
|
||||
|
||||
height_value += line + space
|
||||
number_of_line += 1
|
||||
width_value += column + space
|
||||
number_of_column += 1
|
||||
command.append(os.path.join(temp_dir, 'cut_mark_' + color + '.png'))
|
||||
subprocess.Popen(command, shell=shell).wait()
|
||||
del command[:]
|
||||
|
||||
command.append('convert')
|
||||
command.append(os.path.join(temp_dir, 'cut_mark_' + color + '.png'))
|
||||
command.append('-colorspace')
|
||||
command.append(str(colormode).lower())
|
||||
command.append('-channel')
|
||||
command.append('K')
|
||||
command.append('-separate')
|
||||
command.append(os.path.join(temp_dir, 'cut_mark_' + color + '.png'))
|
||||
subprocess.Popen(command, shell=shell).wait()
|
||||
del command[:]
|
||||
|
||||
final_command.append(os.path.join(temp_dir, 'cut_mark_' + color + '.png'))
|
||||
|
||||
final_command.extend(['-set', 'colorspace', colormode, '-combine', os.path.join(temp_dir, 'cut_mark.tiff')])
|
||||
subprocess.Popen(final_command, shell=shell).wait()
|
BIN
extensions/fablabchemnitz/output_pro/outputpro/preview_mask.png
Normal file
BIN
extensions/fablabchemnitz/output_pro/outputpro/preview_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
extensions/fablabchemnitz/output_pro/outputpro/top.png
Normal file
BIN
extensions/fablabchemnitz/output_pro/outputpro/top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
BIN
extensions/fablabchemnitz/output_pro/result-imp.jpeg
Normal file
BIN
extensions/fablabchemnitz/output_pro/result-imp.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 317 KiB |
Reference in New Issue
Block a user