Reducing resolution of DIN A4 PDF file while maintaining paper size

XnConvert Multi Platform - Windows, MacOSX, Linux
XnBoy
Posts: 11
Joined: Wed Jun 23, 2021 2:11 pm

Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by XnBoy »

Hello!

Sometimes I get very large colour image based PDF files and I would like to reduce image resolution without changing papersize.

The action "Resize" in mode "MPixels" makes optically wonderful results, for example with 3 megapixels limitation for the image.

My problem is: this action also reduces the papersize of the resulting PDF. But I would like to keep the original papersize (here 210 x 297 mm).

What actions could I use to get this?

Thank you,

XnBoy
cday
XnThusiast
Posts: 3072
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Reducing resolution of DIN A4 PDF file

Post by cday »

XnBoy wrote: Thu Jul 08, 2021 9:01 am Sometimes I get very large colour image based PDF files and I would like to reduce image resolution without changing papersize.

The action "Resize" in mode "MPixels" makes optically wonderful results, for example with 3 megapixels limitation for the image.

My problem is: this action also reduces the papersize of the resulting PDF. But I would like to keep the original papersize (here 210 x 297 mm).

What actions could I use to get this?
In principle, you would need to adjust the DPI of the images produced to compensate for the the change in the number of pixels when you resize the image, you can do that using the 'Set DPI' action... If you are reducing to a specified file size, however, you might need to inspect the intitially produced image to find its DPI value.

However, if you are only printing the output images, the 'Fit to page' option that is normally a standard printing option should make the need to adjust the DPI value unnecessary.
XnBoy
Posts: 11
Joined: Wed Jun 23, 2021 2:11 pm

Re: Reducing resolution of DIN A4 PDF file

Post by XnBoy »

if you are only printing the output images
Unfortunately not. I want to save the pdf files. All I need is an action like "Fit to page"... 8)

What I do not understand:
The settings for PS/PDF say: Page size A4. But XnConvert seems to ignore that.

PDF A4.gif
You do not have the required permissions to view the files attached to this post.
cday
XnThusiast
Posts: 3072
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Reducing resolution of DIN A4 PDF file

Post by cday »

XnBoy wrote: Thu Jul 08, 2021 12:32 pm
if you are only printing the output images
Unfortunately not. I want to save the pdf files. All I need is an action like "Fit to page"... 8)
When you print the PDF files created you will have the 'Fit to page' option, and when you view a PDF file on a screen you can control the viewing size. However, a PDF viewer option related to 'page size' will be unlikely to scale correctly, it is true. So for many purposes the actual output image DPI should not matter.

What I do not understand:
The settings for PS/PDF say: Page size A4. But XnConvert seems to ignore that.

PDF A4.gif
I'm not familiar with that setting: it relates to opening PDF files rather than to writing, but may be relevant...

If both the DPI and page size are determined that will define the image pixel dimensions; I'm not sure if then resizing the image to a file size would be compatible with that, in general I think not, which could explain the results you are obtaining. But I don't know, initial thoughts... :wink:
XnBoy
Posts: 11
Joined: Wed Jun 23, 2021 2:11 pm

Re: Reducing resolution of DIN A4 PDF file

Post by XnBoy »

So for many purposes the actual output image DPI should not matter.
Maybe, but I have one of the rare purposes where it does matter. But apart from this, the way XnConvert reduces color depth and making a small fax compressed pdf file from it, is outstanding and I would like to use it regularly.

My purpose is converting colour jpg files to b/w pdf. But after doing this in XnConvert, I find no good way to adjust paper size to DIN A4. All workarounds lead to much bigger PDF files than the one out of XnConvert. They all seem to do some extrapolation of the image pixels, what enlarges the file size.

Where could I make proposals for XnConvert development, like "Feature request: Select paper size of output PDF"? :)
cday
XnThusiast
Posts: 3072
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Reducing resolution of DIN A4 PDF file

Post by cday »

XnBoy wrote: Thu Jul 08, 2021 12:32 pm What I do not understand:

The settings for PS/PDF say: Page size A4. But XnConvert seems to ignore that.

PDF A4.gif
A possible bug -- Pierre?

XnBoy wrote: Thu Jul 08, 2021 9:01 am Sometimes I get very large colour image based PDF files and I would like to reduce image resolution without changing papersize.

The action "Resize" in mode "MPixels" makes optically wonderful results, for example with 3 megapixels limitation for the image.

My problem is: this action also reduces the papersize of the resulting PDF. But I would like to keep the original papersize (here 210 x 297 mm).

What actions could I use to get this?
While waiting for a possible response from Pierre regarding the possible bug you suggest above:

I see that the Resize dialog has a Custom option that can be set to A4 mm dimensions:

Screenshot - Resize.png

Have you tried that option, I imagine you would have to ensure that setting isn't overridden by your Output tab settings.

XnBoy wrote: Tue Jul 20, 2021 12:10 pm
Under this forum heading as XnConvert does not have a separate Suggestions heading, maybe best as a separate thread to make a fresh start?
You do not have the required permissions to view the files attached to this post.
XnBoy
Posts: 11
Joined: Wed Jun 23, 2021 2:11 pm

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by XnBoy »

Yes, I tried that - and there must be at least one bug: settings like 210 x 297 mm lead to 21 x 29 mm pdf files, with a very low resolution, not readable.

Settings like 2100 x 2970 mm lead to the correct paper size of 210 x 297 mm, but to very large files. (50 KB --> 1 MB)

The tool should not touch the real image resolution, or at least it should offer an option to just set the dpi without touching the amount of pixels.
cday
XnThusiast
Posts: 3072
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by cday »

XnBoy wrote: Tue Jul 20, 2021 2:10 pm The tool should not touch the real image resolution, or at least it should offer an option to just set the dpi without touching the amount of pixels.
You've looked at the Image > Set DPI action, have you? That changes the DPI value without changing the number of pixels.

To be useful that would probably require the image pixel dimensions to be constant, though.

Without more detail, and possibly an example file to test, I don't really understand your overall problem, but don't worry about that.

Probably best to file one or more bug reports for specific details, with details of how to reproduce, and if necessary a contrived test file.

In XnView MP you can create a blank canvas of specified dimensions using File > New Image...
XnBoy
Posts: 11
Joined: Wed Jun 23, 2021 2:11 pm

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by XnBoy »

That changes the DPI value without changing the number of pixels.
No, it doesn't. It also has a bug, since it produces very big files, too - with the wrong paper size.
You could use any random image based PDF file to proof your recommendations. They fail due to bugs in XnConvert.
cday
XnThusiast
Posts: 3072
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by cday »

I've checked and as stated above changing an image's DPI value (using the XnConvert Image > Set DPI action) changes the image's 'print' dimensions without changing the image's pixel dimensions... :D

Print size = Pixel dimensions x DPI

For example, an image with height and width both equal to 1000px and DPI=100 pixels per inch has a print size of 10"x10", change the images's DPI value to 200 pixels per inch and the print size changes to 5"x5".

I'll apologise if I'm wrong!


Good news: I think I have a viable solution to your 'reduce filesize while maintaining print size' problem, I should test it again before posting, though... :wink:

Update:

Please see this draft post Reducing image filesize without changing the print size
XnBoy
Posts: 11
Joined: Wed Jun 23, 2021 2:11 pm

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by XnBoy »

Ok, but are you sure this changes the PDF paper size? On my system, it does not. :(
cday
XnThusiast
Posts: 3072
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by cday »

XnBoy wrote: Thu Jul 22, 2021 6:32 am Ok, but are you sure this changes the PDF paper size? On my system, it does not. :(
My test image files had a size of 10"x10" as those were easy dimensions to test, since DPI is expressed in Dots Per Inch.

The properties of my output 10"x10" (254x254mm) PDF file with a reduced filesize display as follows:


1000x1000px_result.png

The 'Paper Size' is unchanged but the filesize is reduced.

Can you clarify what you mean when you say that the method doesn't work for you?

If necessary, you might start by testing one of your A4 size files using exactly my steps, with no additional steps that might introduce another factor.

Alternatively, if easier, upload an example A4 PDF file that I can run through my existing script: if your own files are sensitive, you can create one using XnView MP File > New image... and maybe use the Draw tool to add some text. Or you could resize an existing image to A4 dimensions and save it as a PDF file.
You do not have the required permissions to view the files attached to this post.
XnBoy
Posts: 11
Joined: Wed Jun 23, 2021 2:11 pm

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by XnBoy »

one of your A4 size files
I still do not know if you understood my problem: I do not get A4 size PDF files, this is exactly my problem. I get files like the attached one, when I convert a JPG file just with reducing color depth to sw.

And now I would need a step to make an A4 size PDF file from that. A kingdom for that step. :D
bw from xnconvert.pdf
You do not have the required permissions to view the files attached to this post.
cday
XnThusiast
Posts: 3072
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by cday »

What I need so that we can make progress is a file representative of the files you are *starting* with: if you are unable to supply one of your actual files, please create a file with the same properties in one of the ways I suggested above.

If we both start with the same file, it should be possible to identify where any confusion is arising, and I should be able to show you how to produce a file with reduced filesize while maintaining the same papersize.
cday
XnThusiast
Posts: 3072
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Reducing resolution of DIN A4 PDF file while maintaining paper size

Post by cday »

I have reviewed your posts, given more thought to the issues raised, and think I know have a better understanding of both why you have been having a problem, and how you might be able to more easily obtain the results you need.

If I understand correctly, you have been using the 'Resize' action with the 'Mode - Mpixels' option to reduce the filesize of your images to a specified value, then using the 'Set DPI 'action with 'Keep print size' selected, expecting to obtain an output page size similar to the input file A4 page size.

I suspect that what is happening is that the 'Resize' filesize reduction is reducing the image pixel dimensions without maintaining the page size, and that a new, smaller page size is being maintained when the 'Set DPI' action is performed rather than the original A4 page size.

I suggested a way of reducing the filesize of your images by first using a 'Resize' action to reduce the pixel dimensions by a percentage, then restoring the page size by reducing the DPI value of the images by a corresponding percentage. That worked in my tests, but had the complication of requiring consideration of the actual DPI value of the opened image.

I can now propose a simpler method which seems to work in my quick tests: omit the 'Resize' action completely, and just use a 'Set DPI' action, again with 'Keep print size' selected. Rather than test different 'Mpixels' values to reduce the filesize to an acceptable value, test different lower DPI values which will directly reduce the filesize.

When reducing the filesize by either method image quality will inevitably be reduced, but however the you achieve the reduction, the underlying assumption based on the tests you have already performed is that a satisfactory final result can be obtained with a smaller filesize.