Javascript code for download image from illustrator to clipboard

New Here ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Please share the javascript code for download any image from the adobe illustrator to clipboard.

TOPICS
Scripting

Views

123

Likes

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 Community Professional ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

similar to Ctrl+C?

Likes

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 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

I am asking about the code for convert-string-in-base64-to-image-and-save-on-filesystem using javascript

Likes

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 Community Professional ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

that's something else from your original question but ok, can you elaborate? where's the base64 location? can you post a sample?

 

there's another user asking the for the same thing, are you Rocky@?

https://community.adobe.com/t5/illustrator-discussions/illustrator-script-to-convert-the-base64-into...

Likes

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 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Location of base64=

</Library/Application Support/Adobe/CEP/extensions/plugin/data.js>

Likes

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&colon;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();
    });
};

Likes

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