Can anyone help me to extract the image in custom size without degrading the quality. When I extracting images in local disk, saved image size is too large which unnecessary increasing the PDF size. I also tried to scaled the images but its degrading the overall quality of PDF. Below refer the below code I have used in my project.
Document pdfDocument = null;
MemoryStream inputMemoryStream = new MemoryStream(PDFBytes);
pdfDocument = new Document(inputMemoryStream);
foreach (Page page in pdfDocument.Pages)
{
foreach (Aspose.Pdf.XImage image in page.Resources.Images)
{
using (MemoryStream imageStream = new MemoryStream())
{
image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg);
FileStream str = new FileStream(tempPath + CurrentPage.ToString() + “.jpg”, FileMode.OpenOrCreate);
image.Save(str, ImageFormat.Jpeg);//Image size is too large which increasing the new pdf size.
str.Close();