Convert very large image to image with lower quality

Hi,
I have a very large image file (80MB Jpeg) which is from user uploaded. I want convert it to a new image with lower quality to make its size smaller. can you help me?

@jeffreyshou,

I have observed your requirements and request you to please share the details of the image and its type. You can try the following sample code on your end to serve the purpose.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"G:\Ctrash\Input\08Jan2016052556.png"))
{
image.Resize(200, 200, Aspose.Imaging.ResizeType.LanczosResample);
image.Save();
}

Thanks for reply,
Ok, I got Aspose.Imaging.Image , but how I pass this image to AsposePdfImage, because I need asposePdfImage which can add to pdfDocument.Page[1].Paragraphs. I have searched in Aspose surpport forum but seems I cannot find the solution.

thanks,

@jeffreyshou,

I have observed your comments. Can you please elaborate your query in more details or in form of sample so that we may help you out.

@jeffreyshou

We would like to update you that Aspose.Pdf.Image and Aspose.Imaging.Image classes exist under different namespaces and any implicit or explicit type cast may not be possible. Therefore, you may use MemoryStream to save the image and then load it into the instance of Aspose.Pdf.Image class. Please try using below code snippet in your environment and then share your kind feedback with us.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("Test.png"))
        {
            image.Resize(200, 200, Aspose.Imaging.ResizeType.LanczosResample);
            MemoryStream ms = new MemoryStream();
            image.Save( ms );
            Aspose.Pdf.Document oPdf = new Aspose.Pdf.Document();
            Aspose.Pdf.Page oPage = oPdf.Pages.Add();
            Aspose.Pdf.Image oImage = new Aspose.Pdf.Image();
            oImage.ImageStream = ms;
            oPage.Paragraphs.Add(oImage);
            oPdf.Save(dataDir + "Test_out.pdf");
        }

We hope this will be helpful. Please feel free to contact us if you need any further assistance.