I am splitting PDF file to Images and it is working fine, But issue is that I have PDF file it's size is 2.5 MB after splitting this file into images total size increases to 8 MB. So I don't want to increase these images size because this is storage issue on server.
Code
using (var pdfReader = new PdfReader(fileSavePath))
{
var imagelst = new Pdf2Image(fileSavePath).GetImages(1, pdfReader.NumberOfPages);
foreach (var image in imagelst)
{
imageModal = new ImageModel();
imageModal.FileName = Guid.NewGuid().ToString() + ".png";
image.Save(dirPath + "\\" + imageModal.FileName);
//Using below commented code I can decrease Image size 50 % percent but it creates Image quality problem.
//int newWidth = (int)(image.Width * 0.5);
//int newHeight = (int)(image.Height * 0.5);
//var newImage = ImageHelper.ResizeImage(image, newWidth, newHeight);
//newImage.Save(dirPath + "\\" + imageModal.FileName);
imageModelList.Add(imageModal);
}
}