Converting from PDF to JPEG bad quality

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

HoldThem
Posts: 6
Joined: Thu Jan 15, 2009 12:24 pm

Converting from PDF to JPEG bad quality

Post by HoldThem »

Hi there,

I'm using the GFlax object in my ASP code to convert a PDF file into JPG files. I am finding that the JPEg conversions are a lot worse quality than the original file. My code is as follows:

Code: Select all

    'Sub to chop up PDF file
    sub chopPDF(strPDFLocation, strJPGSaveLocation)
    
        with graphicsCom
            .EpsDpi = 72
            .page = 1
            .LoadBitmap(strPDFLocation)
            
            'Loop through each page in the pdf and save it
            for i = 1 to .NumberOfPages

                .Page = i
                .Saveformat = 1
                .SaveJPEGProgressive = true
                .SaveJPEGQuality = 100  
                .saveBitmap(strJPGSaveLocation & "/" & GetFileName(strPDFLocation) & "_Page" & i & ".jpg")
       
                'Detect width and height
                lngDetectedWidth = .width
                lngDetectedHeight = .height

                'Create the thumbnail               
                .resize THUMB_WIDTH, lngDetectedHeight * (THUMB_WIDTH/lngDetectedWidth)
                .saveBitmap(strJPGSaveLocation & "/thumbnails/" & GetFileName(strPDFLocation) & "_Page" & i & ".jpg")
                
            next                    

        end with 
        
    end sub
An example of the input PDF and output JPG file can be found below:
http://rapidshare.com/files/187557996/PDFJPEG.zip.html

Thanks for any assistance.

Tom
User avatar
xnview
Author of XnView
Posts: 36291
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Converting from PDF to JPEG bad quality

Post by xnview »

And if you change EpsDPI?
Pierre.
HoldThem
Posts: 6
Joined: Thu Jan 15, 2009 12:24 pm

Post by HoldThem »

Thanks for the prompt reply.

Setting the epsdpi to 500 seems to bring it out losslessly, I don't have much idea what epsdpi is, what is it's maximum value? And what does it mean?

(Sorry, I really did look for documentation but couldn't find much!)

Thanks for your help
User avatar
xnview
Author of XnView
Posts: 36291
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Post by xnview »

HoldThem wrote:Thanks for the prompt reply.

Setting the epsdpi to 500 seems to bring it out losslessly, I don't have much idea what epsdpi is, what is it's maximum value? And what does it mean?
It's the dpi used to load pdf
Pierre.
HoldThem
Posts: 6
Joined: Thu Jan 15, 2009 12:24 pm

Post by HoldThem »

Anyway to detect the DPI from the PDF when you load it? And also, if I specify a DPI over the DPI of the pdf, will it create any problems (ie pointless larger file sizes etc)