Despeckling image in PDF

Discussions about PDF management.
Post Reply
fs051268
Posts: 35
Joined: Wed May 22, 2013 4:00 pm

Despeckling image in PDF

Post by fs051268 » Mon Mar 21, 2016 7:10 pm

Hi,

I am using the following code to despeckle an image in a pdf but after saving the pdf, I don's see any changes.
Anything I am doing wrong?

Code: Select all

//pdfImg is a loaded PDF file where page 1 is selected. Page 1 contains one image.
string ImageResName = pdfImg.GetPageImageResName(imageNumber);
bitDepth = pdfImg.GetPageImageBitDepth(imageNumber);
if (bitDepth == 1)
{
	int imgID = pdfImg.ExtractPageImage(imageNumber + 1);
	if (imgID != 0)
	{
		GdPictureStatus myReturn = tiffImg.FxBitonalRemoveIsolatedDots2x2(imgID);
		myReturn = tiffImg.FxBitonalRemoveIsolatedDots4(imgID);
		myReturn = tiffImg.FxBitonalRemoveIsolatedDots8(imgID);
		if (myReturn == GdPictureStatus.OK)
		{
			myReturn = pdfImg.ReplaceImage(ImageResName, imgID, false, false);
		}
		else
		{
		  Debugger.Break();                  
		}
		tiffImg.ReleaseGdPictureImage(imgID);
		imgID = 0;
		pdfImg.SaveToFile("c:\\test.pdf", true);
	  }
	
}

Gabriela
Posts: 278
Joined: Wed Nov 22, 2017 9:52 am

Re: Despeckling image in PDF

Post by Gabriela » Thu Jan 31, 2019 3:20 pm

Hello,

Try to use our Document Clean Up sample with your document:
http://guides.gdpicture.com/content/web ... ement.html
Kind regards,

Gabriela
GdPicture Team

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest