Hi,
When we trying to convert PS image to JPEG image, using Aspose.Page.EPS.PsDocument.SaveAsImage() function, the output JPEG image contain ‘Unwanted white lines’
The code we used: (C# application)
// psFilepath is a valid PS image path
string tempPath = System.IO.Path.GetDirectoryName(psFilepath);
// Output path
string outImage = System.IO.Path.Combine(tempPath, @"AsposeOutput.jpeg");
// create a stream from input PS image file.
FileStream IppsStream = new FileStream(psFilepath, FileMode.Open, FileAccess.Read);
// load the PS file from stream
PsDocument document = new PsDocument(IppsStream);
// create an instance of ImageSaveOptions
Aspose.Page.EPS.Device.ImageSaveOptions options = new Aspose.Page.EPS.Device.ImageSaveOptions();
//set output image format
options.ImageFormat = Aspose.Page.Drawing.Imaging.ImageFormat.Jpeg;
// No error to UI
options.SupressErrors = true;
//Set output image quality as maximum
options.JpegQualityLevel = 100;
options.SmoothingMode = Aspose.Page.Drawing.Drawing2D.SmoothingMode.HighQuality;
if (document.ExtractEpsSize().Width > document.ExtractEpsSize().Height)
{
// Adjust to print area size
options.Size = new Aspose.Page.Drawing.Size(1260, 840);
}
else
{
// Adjust to print area size
options.Size = new Aspose.Page.Drawing.Size(840, 1260);
}
//convert ps file to jpeg and return byte array
byte[][] imagesBytes = document.SaveAsImage(options);
// create a stream for output JPEG file
using (FileStream outStream = File.Open(outImage, FileMode.Create, FileAccess.Write))
{
outStream.Write(imagesBytes[0], 0, imagesBytes[0].Length);
}
Image image = Image.FromFile(outImage);
IppsStream.Close();
We attached 3 files.
- Original_image .jpeg (which has no white lines)
- PS_image_file.ps (PS file has no white line)
- Output_image.jpeg (contains unwanted lines)
Image_file.zip (2.1 MB)
Could you please check this issue and reply as soon as possible.
Thanks
Rejeesh