• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Illustrator Script to save the clipboard in desktop

Contributor ,
Mar 19, 2022 Mar 19, 2022

Copy link to clipboard

Copied

Hi All,

 

Is it possible to save the clipboard image in the desktop using script? And save the clip board image into swatches then apply as color to selected layer via scripting.

TOPICS
Scripting , SDK

Views

362

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
LEGEND ,
Mar 19, 2022 Mar 19, 2022

Copy link to clipboard

Copied

I'm not exactly clear what you mean by all that. If it's AI data, all that would be required is to paste it to a new document. Otherwise you don't have access over pixel data and savcing it to your computer directly would be done much more efficiently using your system's screenshot & clipping tool. Conversely, adding stuff to a swatch requires to sample a color using the eyedroper or creating some sort of selection to e.g. generate a pattern swatch or brush.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 19, 2022 Mar 19, 2022

Copy link to clipboard

Copied

Thanks for the update.

It's not AI image, need to save the image copy from the web(screenshot),  that image will save into swatches or pattern as you mentioned that color will  apply for AI images, this all need to be done via scripting. Is it possible?

 

Screenshot 2022-03-20 at 12.18.33 AM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

Illustrator probably isn't the right tool for this job.. Illustrator is designed for manipulating vector artwork, not processing raster images. There's no built-in way to just create a bunch of swatches from an image...

 

a potential workaround is to use Live Trace with a custom setting to convert the image into vector, then expand the image into a clean vector object, then select the artwork and do "add selected colors" from the swatches panel. theoretically all of that could be done with a script. 

 

but i just re-read your last comment... and i think i misunderstood what you're looking for. you don't want a bunch of swatches that match the colors in the photos... you want a script that automatically converts the copied image into a tileable pattern fill swatch? that's simply not going to be possible in AI.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2022 Mar 24, 2022

Copy link to clipboard

Copied

LATEST

this code is not working to download any image from the adobe illustrator.

function base64(imgPath){
    const base64string = imgPath;
    const pageImage = new Image();
    pageImage.src='data:image/png;base64,' + base64string;
    pageImage.onload = function() {
        const canvas = document.createElement('canvas');
        canvas.width = pageImage.naturalWidth;
        canvas.height= pageImage.naturalHeight;
        const ctx = canvas.getContext('2d');
        ctx.imageSmoothingEnabled = false;
        ctx.drawImage(pageImage, 0, 0);
        saveScreenshot(canvas);
    }
}
function saveScreenshot(canvas) {
    let fileName = "image"
    const link = document.createElement('a');
    link.download = fileName + '.png';
    canvas.toBlob(function(blob) {
        link.href = URL.createObjectURL(blob);
        link.click();
    });
};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

Hi Mylenium,

 

Can you please give your suggestion on this asap.

 

Thanks,

Rishabh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines