c# - Ghostscript increases file size after split PDF -
i splitting pdf file images , working fine, issue have pdf file it's size 2.5 mb after splitting file images total size increases 8 mb. don't want increase these images size because 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 can decrease image size 50 % percent 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); } }
pdf files vector descriptions of page layout. image files bitmaps. 1 of reasons vector descriptions popular because more compact bitmaps.
if bitmaps large can reduce resolution @ render them, reduces quality.
other that, expectations seem unrealistic. image file going larger vector file.
Comments
Post a Comment