Copy link to clipboard
Copied
Hallo zusammen
Ich habe eine völlig verhunzte Illustrator Datei. Keine Ahnung, wie ich das geschafft habe. Ich muss für das Geschäft sehr viele verschiedene Figuren illustrieren. Da es diesselben Figuren in anderen Kostümen sind, wurde die gleiche Datei mit vielen (80) Zeichenflächen genutzt (nach Jahre sortiert).
Jetzt wollte ich mal überprüfen, wie es mit den Farben aussieht, ob alle Volltonfarben für den Druck haben etc. pp, angefangen bei der ersten erstellen Vektorfigur.
Aber: oh schreck! Ich habe pro Figur gefühlt 30 Farben, welche alle angeblich vorhanden sein sollten. Dazu zählen rot in 15 unterschiedlichen Farben, Grau in 10 unterschiedlichen Farben und so weiter... joa. Hmmmm. Ich schätze mal, dass ich (vor allem während der Lehrzeit) vieles mit Farbprofilen verschlimmert habe und der Mischung/Kopiererei von CMYK/RGB Figuren. Ich habe ja nicht bewusst 15 Rottöne verwendet.
Ich wollte ein Script nutzen (mit ChatGPT halt, da ich mich mit scripten nicht auskenne) und wollte ähnliche Farben automatisch zusammenführen lassen, damit ich das nicht händisch selber machen muss. Dann wäre ich, da es wahrscheinlich alle Figuren betrifft, noch bis gefühlt Weihnachten drann.
Das Ziel wäre es eigentlich, eine Druckdatei mit Vollton/Patone zu generieren und separat eine dann im RGB Bereich.
Leider nützt mir keiner der bereitgestellten Scripte.
function mergeSimilarColors() {
var doc = app.activeDocument;
var tolerance = 5; // Tolerance percentage
// Function to calculate the difference between two colors
function colorDifference(color1, color2) {
if (color1.typename === "RGBColor" && color2.typename === "RGBColor") {
return Math.sqrt(
Math.pow(color1.red - color2.red, 2) +
Math.pow(color1.green - color2.green, 2) +
Math.pow(color1.blue - color2.blue, 2)
);
} else if (color1.typename === "CMYKColor" && color2.typename === "CMYKColor") {
return Math.sqrt(
Math.pow(color1.cyan - color2.cyan, 2) +
Math.pow(color1.magenta - color2.magenta, 2) +
Math.pow(color1.yellow - color2.yellow, 2) +
Math.pow(color1.black - color2.black, 2)
);
} else {
return Infinity; // Different color spaces
}
}
// Function to merge colors
function mergeColors(targetColor, sourceColor) {
for (var i = 0; i < doc.pageItems.length; i++) {
var item = doc.pageItems[i];
if (item.filled && item.fillColor.typename === sourceColor.typename && colorDifference(item.fillColor, sourceColor) <= tolerance) {
item.fillColor = targetColor;
}
if (item.stroked && item.strokeColor.typename === sourceColor.typename && colorDifference(item.strokeColor, sourceColor) <= tolerance) {
item.strokeColor = targetColor;
}
}
}
// Iterate through all swatches and merge similar colors
var colorSwatches = doc.swatches;
for (var i = 0; i < colorSwatches.length; i++) {
var targetSwatch = colorSwatches[i];
for (var j = i + 1; j < colorSwatches.length; j++) {
var sourceSwatch = colorSwatches[j];
if (colorDifference(targetSwatch.color, sourceSwatch.color) <= tolerance) {
mergeColors(targetSwatch.color, sourceSwatch.color);
sourceSwatch.remove();
j--;
}
}
}
alert("Similar colors have been merged.");
}
mergeSimilarColors();
Das war mal ein Beispiel. Leider kenne ich mich zu wenig mit Scripting aus, um den Code zu bearbeiten. Oder ist es mit dem Script gar nicht möglich und es bleibt nichts anderes übrig als es händisch zu machen?
Danke für die Hilfe
Copy link to clipboard
Copied
I don't have a script that does what you ask, but another approach is discussed here. Applying a colour group in the Edit Colors dialog might do it, but you'd have to create the 30 colours you wanted first. Or maybe you could auto-trace a rasterized version of your artwork to automatically generate a colour palette?
Otherwise, can you share a file? If it is private, perhaps you can use Effects > Convert to Rectangle on all the shapes or something like that to hide it (don't forget to expand the effect!). So long as we can see all the wild colours!
- Mark
Copy link to clipboard
Copied
Thank you for your answer and your advice! I see that the author of the thread has a similar problem to mine.
I have taken a figure from the Illustrator file and made it available here. In fact, there should be about 500 colours. (I just don't know how, because I can only see a few colours in the picture)
It's not 30 but rather...
I'm still wondering how such an error could occur. It affects a lot of figures.
Copy link to clipboard
Copied
okay I see this file was created 2 years ago and the areas became several areas. I didn't do that deliberately... I have the feeling that some files were messed up with the image redrawer during certain post-processing.
But the problem is also the case with ‘clean’ files. But the solution with your link seems to be the simplest one I have received so far. I will take a closer look at it