Convert PDF to TIFF

I am developing a program that convert PDF files to TIFF files. I use imagemagick++ and can accomplish the concersion successfully. But the resolution of the multi-page TIFF files is too low. My code follows:

vector<Image> imageList;
for(int i = 0; i < imageList.size(); i++)
{
imageList[i].resolutionUnits(PixelsPerInchResolution);
imageList[i].density("300");
}
readImages( &imageList, "E:/gk11.pdf" );
writeImages( imageList.begin(), imageList.end(), "D:/gk11.tif" );

although I change the density in the code, but it seems don't work. Forwardding the solution. Thank you.
Last edited on
Need your help!
You should read the images before your loop. (As it is, your loop doesn't do anything, because your imageList is empty when you loop over it.)

I don't know anything about imagemagick++, BTW, so there might be other problems I don't see.
Thank you, Duoas. I have moved the position of the loop. But the quanlity of the output image is still bad.

vector<Image> imageList;
readImages( &imageList, "E:/gk11.pdf" );

for(int i = 0; i < imageList.size(); i++)
{
imageList[i].resolutionUnits(PixelsPerInchResolution);
imageList[i].density("300");
}
writeImages( imageList.begin(), imageList.end(), "D:/gk11.tif" );
Last edited on
Are you sure that the quality of the images in the PDF are at least as good as the result you want?
Yes, I'm sure. If I convert an one-page PDF to image using the following code:

Image image;
image.density("300");
image.read( "E:/test.pdf");
image.write("E:/test.tif");

The image is pertty as my expectation.
Last edited on

I do this almost daily. I use a PDF converter driver found on the internet . Install it and it becomes a selectable converter option.Then you can convert PDFs to many forms in any program at all, including Adobe Acrobat . Just open a PDF, select convert, then you can convert pdf to tiff , and choice a form you want, the task will be finished in several seconds. if you haven't found a good choice , you can have a try. best wishes.
http://www.rasteredge.com/how-to/csharp-imaging/tiff-convert-pdf/
I don't know anything about imagemagick++ either, but the one thing differing between your list version and your single-image version is setting the resolution units. You set the value in the list version, but in the single-image version you use the default value, whatever it is. Try removing that line from the list version.
Last edited on
Topic archived. No new replies allowed.