RSS/Atom feed Twitter
Site is read-only, email is disabled

script-fu code to load pdf with set resolution

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu code to load pdf with set resolution ashcom 22 Oct 01:40
  script-fu code to load pdf with set resolution saulgoode@flashingtwelve.brickfilms.com 22 Oct 02:02
   script-fu code to load pdf with set resolution ashcom 22 Oct 03:03
  script-fu code to load pdf with set resolution Sven Neumann 22 Oct 08:42
2008-10-22 01:40:27 UTC (over 15 years ago)
postings
2

script-fu code to load pdf with set resolution

I am wanting to write a script that will load a pdf with a specified resolution and then save it as a jpeg.

When I open the pdf document manually (via the GUI). I am greeted with the "Import from PDF" window, which allows me to set the resolution of the image which then alters the width and height of the image based on the resolution specified.

However, when I attempt to automate this with script-fu, I am having issues getting the same functionality.

I am using the 'file-pdf-load' function to load the pdf, however there is no option to set the resolution and height of the image. (It appears to default to 100dpi). I can use the 'gimp-image-set-resolution' function to set the resolution but this doesn't automatically update the width and height of the image. When I alter the size of the image using 'gimp-image-resize' it seems to keep the image at the same size but sets the extra area to transparent.

Is this functionality possible or am I missing something completely?

Needless to say I am quite new to script-fu.

Thanks.

saulgoode@flashingtwelve.brickfilms.com
2008-10-22 02:02:46 UTC (over 15 years ago)

script-fu code to load pdf with set resolution

Quoting "Ash C." :

I am wanting to write a script that will load a pdf with a specified resolution and then save it as a jpeg.

... When I alter the size of the image using 'gimp-image-resize' it seems to keep the image at the same size but sets the extra area to transparent.

In GIMP terminology, "resize" refers to changing the size of the canvas. Changing the size of the image is termed "scaling". If using 'gimp-image-scale' (instead of 'gimp-image-resize') does not address your difficulty, I will put more consideration into my next response :)

2008-10-22 03:03:30 UTC (over 15 years ago)
postings
2

script-fu code to load pdf with set resolution

Quoting "Ash C." :

I am wanting to write a script that will load a pdf with a specified resolution and then save it as a jpeg.

... When I alter the size of the image using 'gimp-image-resize' it seems to keep the image at the same size but sets the extra area to

transparent.

In GIMP terminology, "resize" refers to changing the size of the canvas. Changing the size of the image is termed "scaling". If using 'gimp-image-scale' (instead of 'gimp-image-resize') does not address your difficulty, I will put more consideration into my next response :)

Thanks for the quick response. I've actually messed around a little with scaling the image but it appears to degrade the imagery somewhat. I did the process manually whereby loading the image at 100dpi then scaling to 300dpi and increasing the width and height by 3 also but the resultant image was quite degraded compared to loading the PDF directly at 300dpi with the appropriate width and heights. The interpolation setting appears to make very little difference.

Sven Neumann
2008-10-22 08:42:16 UTC (over 15 years ago)

script-fu code to load pdf with set resolution

Hi,

On Wed, 2008-10-22 at 01:40 +0200, Ash C. wrote:

I am wanting to write a script that will load a pdf with a specified resolution and then save it as a jpeg.

When I open the pdf document manually (via the GUI). I am greeted with the "Import from PDF" window, which allows me to set the resolution of the image which then alters the width and height of the image based on the resolution specified.

However, when I attempt to automate this with script-fu, I am having issues getting the same functionality.

I am using the 'file-pdf-load' function to load the pdf, however there is no option to set the resolution and height of the image. (It appears to default to 100dpi).

This functionality is not available to the PDB. We would accept a patch that improves the PDB interface of the PDF import plug-in.

But seriously, I don't understand why you would want to use GIMP for this instead of a simple
'pdftoppm -r 300 | pnmtojpeg '

Sven