Feb. 9th, 2014

In this post, I gave instructions on how to sharpen blurry PDF files using IrfanView.

I noticed recently however, that sharpening a PDF file in this manner may result in a loss of resolution in the sharpened file. When one views the sharpened PDF file at a high zoom level, much more pixelation may be visible than in the original file at the same zoom level.

After some research, I've figured out how to avoid such loss of resolution.

IrfanView's settings are stored in an "i_view32.ini" file. The file may exist in one or more of the following locations:
- the IrfanView program install folder
- C:\Users\[user-name]\AppData\Roaming\IrfanView
- C:\Users\[user-name]\AppData\Local\VirtualStore\Program Files (x86)\IrfanView

On my Windows 7 computer, different versions of the file are in each of these 3 folders, but based on the file timestamps, the one in the last folder is the one which actually gets updated and used.

Two sections of the ini file are related to viewing and saving PDF files.

One section is labelled "[Ghostscript]". This has the Ghostscript PlugIn settings which are used for reading the PDF image data into memory and rendering it. The values can be updated from within IrfanView by selecting Options - Properties/Settings... - Plugins - Postscript Options. My original Ghostscript PlugIn DPI settings were 96x96, which explains why I was losing resolution when re-saving PDF files. The DPI settings here should be set at least as high as the resolution of the original file. If you scan files at 300 dpi, then use 300x300. If you scan at 600 dpi, then use 600x600.

Note that when using higher DPI values, the conversion process will take longer, and the intermediate TIF file will be much larger in size. Adequate disk space is required.

The other relevant section is labelled "[ImPDF]". This corresponds to the "PDF Settings" window that is shown when saving a file in IrfanView to PDF format. To avoid large PDF file sizes, "Activate Compression" should be selected on the "Compression" tab. For both 300 and 600 dpi, I've found that the "JPEG (high quality)" setting gives very good quality with relatively small file sizes.

Using a batch file

If using the batch file method of sharpening a PDF file as mentioned in the prior post, the ini file that you use should contain both the [Ghostscript] and [ImPDF] sections. I've found it easiest to update the DPI and Compression settings as mentioned above (as well as the Advanced Batch Conversion settings as mentioned in the prior post) from within IrfanView, and then to copy the ini file from the above-mentioned location to my chosen folder.

It is best to update your batch file to use the copied ini file on both steps. That way, your batch file will always give the same results regardless if you later change the settings within IrfanView while working with other files.

   "C:\Program Files (x86)\IrfanView\i_view32.exe" %1 /advancedbatch /ini="C:\bat\irfanviewSharpen" /convert=%~p1\%~n1_x.tif

   "C:\Program Files (x86)\IrfanView\i_view32.exe" %~p1\%~n1_x.tif /ini="C:\bat\irfanviewSharpen" /convert=%~p1\%~n1_x.pdf

   @del %~p1\%~n1_x.tif

The above commands keep the original PDF file unchanged, and create another PDF file with "_x" on the end of the name. You can compare both files to verify that no loss of resolution has occurred, and that the amount of sharpening is satisfactory. If not, try updating each of the settings that were mentioned until you get the desired results.



September 2017

     1 2

Most Popular Tags

Active Entries

Style Credit

Expand Cut Tags

No cut tags