<div dir="ltr"><div class="gmail_default" style="font-size:small">The whole thing (do the job with SVG imported colors too):<br><br>#!/usr/bin/env python<br># -*- coding: utf-8 -*-<br><br>import sys<br><br>try:<br> import scribus<br>
except ImportError,err:<br> print "This Python script is written for the Scribus scripting interface."<br> print "It can only be run from within Scribus."<br> sys.exit(1)<br><br>#########################<br>
# YOUR IMPORTS GO HERE #<br>#########################<br><br>def main(argv):<br> """Translate imported RGB colors to CMYK colors."""<br> #########################<br> # YOUR CODE GOES HERE #<br>
#########################<br> if scribus.haveDoc():<br> clrs = scribus.getColorNames()<br> newname = ""<br> for clr in clrs:<br> if clr.find("From") == 0:<br> cmyk = scribus.getColor(clr)<br>
c = cmyk[0]<br> cd = cmyk[0]*100/255<br> ca = "c"+str(cd)<br> m = cmyk[1]<br> md = cmyk[1]*100/255<br> ma = "m"+str(md)<br>
y = cmyk[2]<br> yd = cmyk[2]*100/255<br> ya = "y"+str(yd)<br> k = cmyk[3]<br> kd = cmyk[3]*100/255<br> ka = "k"+str(kd)<br>
newname = ca+ma+ya+ka<br> scribus.defineColor(newname,c,m,y,k)<br> scribus.replaceColor(clr,newname)<br> scribus.deleteColor(clr,newname)<br><br>def main_wrapper(argv):<br>
"""The main_wrapper() function."""<br> try:<br> scribus.statusMessage("Running script...")<br> scribus.progressReset()<br> main(argv)<br> finally:<br>
if scribus.haveDoc():<br> scribus.setRedraw(True)<br> scribus.statusMessage("")<br> scribus.progressReset()<br><br>if __name__ == '__main__':<br> main_wrapper(sys.argv)<br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/1 José Antonio Rocha <span dir="ltr"><<a href="mailto:joseantoniorocha@gmail.com" target="_blank">joseantoniorocha@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Unbelievably easy:<br><br>clrs = getColorNames()<br>
newname = ""<br>
for clr in clrs:<br> if clr.find("FromPDF") == 0:<br> cmyk = getColor(clr)<br>
c = cmyk[0]<br> cd = cmyk[0]*100/255<br> ca = "c"+str(cd)<br> m = cmyk[1]<br> md = cmyk[1]*100/255<br> ma = "m"+str(md)<br> y = cmyk[2]<br> yd = cmyk[2]*100/255<br>
ya = "y"+str(yd)<br> k = cmyk[3]<br> kd = cmyk[3]*100/255<br> ka = "k"+str(kd)<br> newname = ca+ma+ya+ka<br> defineColor(newname,c,m,y,k)<br> replaceColor(clr,newname)<br>
deleteColor(clr,newname)<br><br></div></div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">2013/3/31 "Christoph Schäfer" <span dir="ltr"><<a href="mailto:christoph-schaefer@gmx.de" target="_blank">christoph-schaefer@gmx.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I have brought on board another commercial colour vendor, this time one from North America. At the moment, we are feverishly working on all sorts of issues, including documentation, colour correctness, logo exchange, licensing etc.<br>
<br>
You could help to speed up the process by writing a shell or Python script.<br>
<br>
I receive all palettes as EPS files, which are easy to convert to Scribus's own XML palette format. However, since the colours aren't stored as spot colours, they end up being imported as something like "FromPDF#00000040", which is completely useless when referring to a printed colour swatch that is based on CMYK ink mixtures.<br>
<br>
In a Scribus XML palette file, the converted colour entry looks like this:<br>
<br>
<COLOR NAME="FromPDF#00404040" CMYK="#00404040"/><br>
<br>
What is needed is a script that strips the string FromPDF and converts the hex value in a specific way (adding ink channel abbreviations and slashes), so that the end result looks like this:<br>
<br>
<COLOR NAME="C25/M25/Y25/K25" CMYK="#40404040"/><br>
<br>
Anyone willing to step in?<br>
<br>
<br>
Thanks in advance and Happy Easter,<br>
<br>
Christoph<br>
<br>
___<br>
Scribus Mailing List: <a href="mailto:scribus@lists.scribus.net" target="_blank">scribus@lists.scribus.net</a><br>
Edit your options or unsubscribe:<br>
<a href="http://lists.scribus.net/mailman/listinfo/scribus" target="_blank">http://lists.scribus.net/mailman/listinfo/scribus</a><br>
See also:<br>
<a href="http://wiki.scribus.net" target="_blank">http://wiki.scribus.net</a><br>
<a href="http://forums.scribus.net" target="_blank">http://forums.scribus.net</a><br>
</blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br>
<font style="font-family:Helvetica,Arial,sans-serif" color="#888888"><font style="font-family:Helvetica,Arial,sans-serif" color="#888888"><font style="font-family:Helvetica,Arial,sans-serif" color="#888888"><font size="1"><font><img style="width:75px;min-height:100px" alt="Meira" src="http://lh4.ggpht.com/_75EesisxR5g/TENbAQVXMLI/AAAAAAAADHs/ChNQzn8eOT0/meira-75x100.jpg" align="left" hspace="8" vspace="6"></font></font></font></font><hr>
</font><span style="font-family:Helvetica,Arial,sans-serif">nome: "</span><span style="font-weight:bold;font-family:Helvetica,Arial,sans-serif">José Antonio Meira da Rocha</span><span style="font-family:Helvetica,Arial,sans-serif">" </span><br style="font-family:Helvetica,Arial,sans-serif">
<small style="font-family:Helvetica,Arial,sans-serif">googletalk: email: MSN: <a href="mailto:joseantoniorocha@gmail.com" target="_blank">joseantoniorocha@gmail.com</a><br>
veículo: [ <a href="http://meiradarocha.jor.br/" target="_blank">http://meiradarocha.jor.br</a>
] <br>fones: <a href="tel:55-8411-3047" value="+555584113047" target="_blank">55-8411-3047</a> / <a href="tel:55-3744-2994" value="+555537442994" target="_blank">55-3744-2994</a><br></small>
<hr style="width:100%;min-height:2px;font-family:Helvetica,Arial,sans-serif">
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br>
<font style="font-family:Helvetica,Arial,sans-serif" color="#888888"><font style="font-family:Helvetica,Arial,sans-serif" color="#888888"><font style="font-family:Helvetica,Arial,sans-serif" color="#888888"><font size="1"><font><img style="width:75px;min-height:100px" alt="Meira" src="http://lh4.ggpht.com/_75EesisxR5g/TENbAQVXMLI/AAAAAAAADHs/ChNQzn8eOT0/meira-75x100.jpg" hspace="8" vspace="6" align="left"></font></font></font></font><hr>
</font><span style="font-family:Helvetica,Arial,sans-serif">nome: "</span><span style="font-weight:bold;font-family:Helvetica,Arial,sans-serif">José Antonio Meira da Rocha</span><span style="font-family:Helvetica,Arial,sans-serif">" </span><br style="font-family:Helvetica,Arial,sans-serif">
<small style="font-family:Helvetica,Arial,sans-serif">googletalk: email: MSN: <a href="mailto:joseantoniorocha@gmail.com" target="_blank">joseantoniorocha@gmail.com</a><br>
veículo: [ <a href="http://meiradarocha.jor.br/" target="_blank">http://meiradarocha.jor.br</a>
] <br>fones: 55-8411-3047 / 55-3744-2994<br></small>
<hr style="width:100%;height:2px;font-family:Helvetica,Arial,sans-serif">
</div>