C#
Convert AI to JPG with C#
황기하
2022. 1. 20. 02:00
Converting AI files to JPG image is simple. You need to follow the steps below:
- Load input AI file with AiImage class
- Set ImageOptionsBase properties
- 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);
}
}