C#

Convert AI to JPG with C#

황기하 2022. 1. 20.

Converting AI files to JPG image is simple. You need to follow the steps below:

  1. Load input AI file with AiImage class
  2. Set ImageOptionsBase properties
  3. Save output JPG image

Following code snippet shows how to convert AI to JPG in C# applications:

 

string[] sourcesFiles = new string[]
{
    @"34992OStroke",
    @"rect2_color",
};

for (int i = 0; i < sourcesFiles.Length; i++)
{
    string name = sourcesFiles[i];
    string sourceFileName = dataDir + name + ".ai";
    string outFileName = dataDir + name + ".jpg";

    using (AiImage image = (AiImage)Image.Load(sourceFileName))
    {

        ImageOptionsBase options = new JpegOptions() { Quality = 85 };
        image.Save(outFileName, options);

    }
}

'C#' 카테고리의 다른 글

How to Convert AI to PDF Using C#  (0) 2022.01.20

댓글