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

Convert JPG/PNG using AI

Community Beginner ,
Sep 27, 2017 Sep 27, 2017

Copy link to clipboard

Copied

@williamdowHi,

I want to create a dynamic PNG/JPG file programmatically for AI extension.

For photoshop i'm using this approach:

Created a PSD as a template, parse it and created duplicate of it in JSX, then replace the content of all the layers and merge/convert it to JPG and PNG.

var templateDoc = app.open(new File(extPath + '/images/zcdp_palette_template_'+orientation+'.psd'));

  var dupeDoc = templateDoc.duplicate(filePath.match(/[^\/]+$/)[0]);

  templateDoc.close(SaveOptions.DONOTSAVECHANGES);

But this code is not working in AI. It throws error while duplicating the psd. //templateDoc.duplicate() is not a function

Is it possible to maintain same code base for PS and AI

Or is there any other approach in AI to create PNG/JPG and place text and color rectangle on x,y axis of document (HTML5 Canvas style)

williamadowling​

TOPICS
Scripting

Views

729

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 Expert ,
Sep 28, 2017 Sep 28, 2017

Copy link to clipboard

Copied

LATEST

duplicate is not a method of the Document object. To duplicate, you'll have to simply open the file and then do a save-as.

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