【问题标题】:How do you find the paths of linked images in Adobe Illustrator 9? [closed]您如何在 Adob​​e Illustrator 9 中找到链接图像的路径? [关闭]
【发布时间】:2010-10-06 03:48:30
【问题描述】:

我有一个带有链接图像的 Illustrator 文件。我实际上想嵌入图像。我首先必须知道它们是哪些文件。我怎么知道?我正在使用 Illustrator 9。

【问题讨论】:

    标签: image adobe-illustrator


    【解决方案1】:

    我使用的第一个 Illustrator 版本是 10,但是,版本 9 中有链接调色板吗?尝试窗口菜单并寻找“链接”。它有几个选项可以搜索您想要的图像、重新链接、打开原始图像等。

    【讨论】:

    • 啊!在链接调色板中有文件名,但没有它的路径。选项: - 替换链接 - 转到链接(转到文档中的图像,而不是文件系统) - 更新链接(刷新) - 编辑原始链接(尝试某些操作并失败) 不太对,但我现在可以使用搜索找到文件.谢谢!
    【解决方案2】:

    很高兴知道海报已经设置好,但这并不能回答问题。在 CS3 中,如果您双击链接面板中的图像,ti 将显示链接元素的链接信息,其中显示文件的路径(前提是它不长于窗口)。

    也许旧版本也允许您这样做。

    不幸的是,如果您正在处理丢失的链接元素(您在打开文件时忽略了该元素以进行修复),则此字段为空白。与 InDesign 相比,Illustrator 在文件打包和链接方面很糟糕。如果它可以像 InDesign 一样打包文件,并存储对外部资源的相对引用,那就太好了。

    【讨论】:

      【解决方案3】:

      我使用以下 perl 脚本来跟踪 Illustrator 文件中的链接图像。这对于断开的链接特别有用,因为它仍然会通过在 Illustrator 文件中窥视来告诉您链接图像的完整路径。它显然比这里任何人都需要做的更多,但也许它会很有用。帮助应该解释如何使用它。在我的机器上,我将其命名为 ailinkedfiles.pl,并将其放入 ~/bin 中,它位于我的 PATH 中。

      #!/usr/bin/perl 
      
      # program to find the linked files inside an Adobe Illustrator file
      require 5.004;
      use File::Basename;   # to extract a filename from a full path
      use File::Find;       # to build a list of files
      use File::Spec;       # Platform independent way to build paths
      use vars qw/ %opt /;  # for command line options - see init()
      use strict;
      
      
      init(); # process command line options
      
      # Autoflush stdout
      $|=1;
      
      if ($opt{p}){
       die "Did you really mean to call your script ".$opt{p}."!\n" if($opt{p} =~ /\.ai$/i); 
       print "Generating script file $opt{p}\n" if $opt{v};
       open SCRIPT, "> $opt{p}"; 
      }
      
      die "No input specified; use ".basename($0)." -h for help\n" if(@ARGV==0);
      my $arg; foreach $arg (@ARGV){
       if(-d $arg){
        # nb it is necesary to convert the directory specification
        # to an absolute path to ensure that the open in &findLinkedFiles
        # works properly during multi directory traversal
        my $InDir=File::Spec->rel2abs($arg); 
        find(\&handleFind,$InDir); 
       } elsif (-f $arg) {
       my $InDir=File::Spec->rel2abs(dirname($ARGV[0])); 
         &findLinkedFiles(File::Spec->rel2abs($ARGV[0]),$InDir) ;
      #   &findLinkedFiles(File::Spec->rel2abs($arg)) ;
       }
      }
      
      sub init()
      # copied from: http://www.cs.mcgill.ca/~abatko/computers/programming/perl/howto/getopts
      {
       use Getopt::Std;      # to handle command line options
       my $opt_string = 'hvlzdsftnp:ux:';
       getopts( "$opt_string", \%opt ) or usage();
       usage() if $opt{h};
      }
      
      # Print out usage information
      sub usage()
      {
       print STDERR << "EOF"; 
      Usage: $0 [OPTIONS] <AIFILE/DIR>
      
      Parse an Adobe Illustrator file or (recursively) parse a directory of ai files
      and print a list of the linked files to STDOUT.  These could be piped to xargs eg:
      $0 aifile.ai | xargs -I {} ln -vs
      
       -h print this help
       -v verbose ouput
       -s print file names with short path
       -d print current directory on each line
       -n no-print (suppresses printing of linked file names)
       -x <regex> exclude files whose full path matches regex 
      
       -l symlink in current directory if file linked from Illustrator file exists somewhere else
       -f force symlink to overwrite existing target file
       -t test run
       -p <file> write commands to a script file
      
       -u status of src and target
        - doesn't exist
        F plain file
        L symbolic link
        E exists (unknown file type)
      
       Note that src is the link contained in the Illustrator file and
       target is a file of the same name in the same directory as the Illustrator file
      
       If the status is -- you will have problems in Illustrator
       If the status is -F Illustrator will substitute the local file for the unavailable linked file
       If the status is F- you can run this script with the -s option to make a symlink 
       If the status is FF then Illustrator will be happy 
      
      EOF
       exit();  
      }
      
      sub mysymlink{
       my ($src,$targetdir)=@_;
       my $target=File::Spec->catdir($targetdir,basename($src)); 
      
       if(File::Spec->rel2abs($src) eq File::Spec->rel2abs($target)){
        print "src and target identical for src=$src\n" if $opt{v};  
        return;  
       }
      
       if(-e $src){
        my $opts=$opt{f}?"-fsv":"-sv";  
        my $cmd="ln $opts \"$src\" \"$target\"";   
        myexec("$cmd");
       } else {
        print "No link made: $src doesn't exist\n" if $opt{v};
       }
      }
      sub myexec {
       my ($cmd) = @_; 
       if ($opt{t}){
        print STDERR "test: $cmd\n";
       }  elsif ($opt{p}){
        print SCRIPT $cmd,"\n";
       }  else {
        # should get to see output with system
        print STDERR "run: $cmd\n" if $opt{v}; 
        return system $cmd;  
       }
      }
      
      sub mystatus{
       my ($src,$targetdir)=@_;
       my $target=File::Spec->catdir($targetdir,basename($src)); 
      
       my ($ss,$ts)=("-","-"); 
      
       $ss = "E" if(-e $src);
       $ss = "F" if(-f $src); 
       $ss = "L" if(-l $src);
       $ts = "E" if(-e $target);
       $ts = "F" if(-f $target); 
       $ts = "L" if(-l $target);
       return ($ss.$ts);
      }
      
      # This extracts the file info from the header
      sub handleFind{
       # get the file name
       my $FullFoundFile = $File::Find::name;
       #print $FullFoundFile,"\n";
      
       return if ($opt{x} and $FullFoundFile =~ /$opt{x}/i); 
      
       # parse if it ends in ai
       findLinkedFiles($FullFoundFile, $File::Find::dir) if ($FullFoundFile =~ /\.ai$/i);
      }
      
      
      # This does the actual parsing of the Illustrator Files
      sub findLinkedFiles{
       my ($InFile,$InDir)=@_; 
      
       # protect with escaped quotes for shell if non-empty
       my $ProtectedInDir=$InDir?"\"$InDir\"":$InDir; 
      
       die "Can't open $InFile \: $!\n"  unless open(AIFILE, "<$InFile");
       binmode(AIFILE);
      
       # %%DocumentFiles is the starting point 
       $/="%%"; 
       my @lines = readline<AIFILE>; 
      
       if(@lines==0){
        print STDERR "can't read header of $InFile\n" if $opt{v} ; # the header length
        return;   
       }
      
       print "################\n"; 
      
       if ($opt{s}){
        print "# FILE = ",basename($InFile),"\n";  
       } else {
        print "# FILE = ",$InFile,"\n"; 
       }
       for my $i ( 0 .. $#lines ){  
      #  if ( $lines[$i]=~/^DocumentFiles\:(.*?)\W+%%/){
      # not sure why we need two % signs here
        if ( $lines[$i]=~/^DocumentFiles\:(.*?)\W+%/){
         print mystatus($1,$InDir)," " if $opt{u} and not $opt{n};
         print "\"$1\" ",$opt{d}?$ProtectedInDir:"","\n" unless $opt{n};
         $i++;
         mysymlink($1,$InDir) if $opt{l};
         while($lines[$i]=~/^[+](.*?)\W\%.*$/){
      #    print "\"$1\" $InDir\n"; $i++;   
          print mystatus($1,$InDir)," " if $opt{u} and not $opt{n};
          print "\"$1\" ",$opt{d}?$ProtectedInDir:"","\n"unless $opt{n};
          $i++;
          mysymlink($1,$InDir) if $opt{l};     
         }
      
        }
       } 
      }
      

      【讨论】:

        【解决方案4】:

        使用较新版本的 Illustrator,您或许可以使用此脚本替换损坏图像的链接:

        http://techblog.willshouse.com/2011/01/16/update-illustrator-linked-files-script/

        【讨论】:

          【解决方案5】:

          我刚刚在 Illustrator CS4 中遇到了这个问题;我的很多东西最近都被归档了。

          单击画板中的“缺失”图像。

          在左上角,您将看到显示的文件名。

          在随后的下拉菜单中单击“编辑原件”。 Illustrator 将尝试查找文件,并闪烁警告窗口“windows 找不到文件”等,为您提供完整的文件位置。

          这很有用,因为编辑原件在链接窗口中显示为灰色。对于像我这样拥有大量文件库的人来说非常有用。

          【讨论】:

            猜你喜欢
            • 2011-02-24
            • 2018-09-08
            • 2013-07-13
            • 1970-01-01
            • 2014-11-04
            • 1970-01-01
            • 2014-05-27
            • 2013-07-07
            • 2011-11-14
            相关资源
            最近更新 更多