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

Script-Fu - Batch Mode Problem

This discussion is connected to the gimp-developer-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.

9 of 9 messages available
Toggle history

Please log in to manage your subscriptions.

Script-Fu - Batch Mode Problem matt@solinus.com 19 Dec 23:57
  Script-Fu - Batch Mode Problem Steinar H. Gunderson 20 Dec 00:03
  Script-Fu - Batch Mode Problem Sven Neumann 20 Dec 12:48
Script-Fu - Batch Mode Problem matt@solinus.com 20 Dec 00:29
  Script-Fu - Batch Mode Problem Steinar H. Gunderson 20 Dec 00:33
   Script-Fu - Batch Mode Problem Patrick McFarland 20 Dec 03:34
    Script-Fu - Batch Mode Problem Jay Cox 20 Dec 11:03
  Script-Fu - Batch Mode Problem Marc) (A.) (Lehmann 22 Dec 11:35
Script-Fu - Batch Mode Problem matt@solinus.com 26 Dec 20:19
matt@solinus.com
2002-12-19 23:57:19 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

I had posted this earlier to the gimp-users list....Someone suggested that I may find an answer on this list. I am looking for an suggestion you can provide.

Matt Patterson matt@solinus.com

-- Forwarded message from matt@solinus.com -- Hello,

I am having an issue with a Script that I have written being called from the command line.

Here is what I am trying to do. I have written a script using Scheme that runs great when I have Gimp loaded up (ie not from the command line). No problems, does everything that I want. The real point of the script is to automate some image resizing from the command line. I know that many of you out there are going to point out that ImageMagick will do what I am looking for. I have already gone down that path and the image quality of the scaled images is not up
to the quality that client wants. However, I can make a better, smaller image using Gimp....now I just need to make it completely automated.

here is the rub.....

I have the script streamlined down and everything is set to be non-interactive. So i should just be able to pass in the variables and away we
go.... My thinking is obviously flawed here as it doesn't quite work.

here is how I am calling the script:....

gimp -b '(script-fu-automated-resize 1 "200" "200" "/export/home/matt/toprocess/Imagein.jpg" "/export/home/matt/toprocess/Imageout.jpg")' '(gimp-quit 0)'

The script takes in a height, width, beginning image and output image. I pass it a 1 before all of that for non-interactive. The script is designed to open the beginning image, resize accordingly, and then save to the output image.

I get the following response..... batch command: executed successfully.

One would think that I should be able to check my system and I should see the end image....nope....nada...nothing. If I change the option of 1 to 0 to run in
interactive mode...I get the prompt for the default values of the script. Height, Width, Image to process....final image. If I enter those in, click the ok button....it runs like a champ. What am I missing? I have the non-interactive bit set on the file open which I assume is what is causing this dialog to pop up.

Any ideas? tips? Pointer? References? Anyone already have a thumbnail script that works in this way that can shed some light on the subject?

Matt Patterson matt@solinus.com

-- end forwarded message --

Steinar H. Gunderson
2002-12-20 00:03:30 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

On Thu, Dec 19, 2002 at 10:57:19PM -0000, matt@solinus.com wrote:

I have already gone down that path and the image quality of the scaled images is not up to the quality that client wants. However, I can make a better, smaller image using Gimp....now I just need to make it completely automated.

If you can't make an image in ImageMagick that is at least as good as what you get from The GIMP, you're doing something wrong. Have you tried specifying what kind of filter you want to use?

/* Steinar */

matt@solinus.com
2002-12-20 00:29:08 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

On Wed, 18 Dec 2002 23:15:42 -0000 (GMT), "Steinar H. Gunderson" wrote:

If you can't make an image in ImageMagick that is at least as good as what you get from The GIMP, you're doing something wrong. Have you tried specifying what kind of filter you want to use?

/* Steinar */

That's what I thought as well...but the scaling with imagemagick was causing pixelation. granted, it wasn't a lot of pixelation but the client that I am doing this for is having a problem with it. I tried specifying filters, scaled it every which way I could find documentation for on the imagemagick site. And I could get a good image, but not to the satisfaction of the customer. It appeared to be the way in which imagemagick scales the image as opposed to gimp. Gimp seems to handle it better. I would think it would be pretty much a wash but based on what i have coded up so far....it's not the case. At least not for the client who is really really picky about the pixelation.

Matt Patterson matt@solinus.com

Steinar H. Gunderson
2002-12-20 00:33:15 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

On Thu, Dec 19, 2002 at 11:29:08PM -0000, matt@solinus.com wrote:

That's what I thought as well...but the scaling with imagemagick was causing pixelation.

Scaling up or down? With which filter? (You're sure you resampled and not did a simple quick rescale, right?)

/* Steinar */

Patrick McFarland
2002-12-20 03:34:11 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

On 20-Dec-2002, Steinar H. Gunderson wrote:

On Thu, Dec 19, 2002 at 11:29:08PM -0000, matt@solinus.com wrote:

That's what I thought as well...but the scaling with imagemagick was causing pixelation.

Scaling up or down? With which filter? (You're sure you resampled and not did a simple quick rescale, right?)

If your're scaling down in gimp, go into preferences, and change scaling mode to linear. Cubic sucks for scaling down, and Im not sure why Gimp even allows users to make a choice (bicubic and such are always used for scaling up, bilinear and such are always used for scaling down.)

Jay Cox
2002-12-20 11:03:33 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

On Thu, 2002-12-19 at 18:34, Patrick McFarland wrote:

On 20-Dec-2002, Steinar H. Gunderson wrote:

On Thu, Dec 19, 2002 at 11:29:08PM -0000, matt@solinus.com wrote:

That's what I thought as well...but the scaling with imagemagick was causing pixelation.

Scaling up or down? With which filter? (You're sure you resampled and not did a simple quick rescale, right?)

If your're scaling down in gimp, go into preferences, and change scaling mode to linear. Cubic sucks for scaling down, and Im not sure why Gimp even allows users to make a choice (bicubic and such are always used for scaling up, bilinear and such are always used for scaling down.)

Do you even use gimp? When downsampling gimp will use bilinear filtering even when bicubic is specified. There are usefull techniques that require the use of nearest neighbor or bilinear resampling.

I'm not sure why gimp would do a better job of downsampling than imagemagick. It doesnt do anything fancy, just a rectangular area-sample.

Sven Neumann
2002-12-20 12:48:31 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

Hi,

matt@solinus.com writes:

I had posted this earlier to the gimp-users list....Someone suggested that I may find an answer on this list. I am looking for an suggestion you can provide.

I am having an issue with a Script that I have written being called from the command line.

we will only be able to help you if you provide the script or (preferably) a smaller test script that triggers the problem.

Salut, Sven

Marc) (A.) (Lehmann
2002-12-22 11:35:19 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

On Thu, Dec 19, 2002 at 11:29:08PM -0000, matt@solinus.com wrote:

I could get a good image, but not to the satisfaction of the customer. It appeared to be the way in which imagemagick scales the image as opposed to

Do you have an example image? Really, either you hit a bug in imagemagick itself, or you are simply doing sth. wrong. ImageMagick can use exactly the same algorithm as gimp.

gimp. Gimp seems to handle it better. I would think it would be pretty much a wash but based on what i have coded up so far....it's not the case. At least not for the client who is really really picky about the pixelation.

What, exactly, were you doing (state the command line) with imagemagick?

matt@solinus.com
2002-12-26 20:19:04 UTC (over 21 years ago)

Script-Fu - Batch Mode Problem

I posted this to the users group and unfortunately did not read the reply-to correctly. I meant to send it over here. Here is the original message, reply and corrected attachment (for those who are also on the gimp-users list)

--Matt

-- Forwarded message from matt@solinus.com --
On Thu, 19 Dec 2002 04:32:07 -0000 (GMT), wrote:

On Thu, Dec 19, 2002 at 07:35:36PM -0000, matt@solinus.com wrote:

image resizing from the command line. I know that many of you out there

are

going to point out that ImageMagick will do what I am looking for. I have already gone down that path and the image quality of the scaled images is

not up

Then you probably have done sth. wrong, as ImageMagick's algorithms are way superior (and way slower ;) to the mere cubic interpolation gimp uses.

Are you sure you tried sth. like:

convert sourcefile -filter mitchell -geometry destfile

ok, I tried this....and I got an image that was not up to par with what can be done with Adobe's Image ready doing a similiar process. However, with Gimp, I can produce an image that is better and smaller than what Image Ready and ImageMagick can do. The mitchell filter was better than the cubic filter by far...but they were still pixelated when you started to look at the images closely. I personally think the images are good enough for the web....however, the client that I am working for is accustom to having an image of a very high quality.

also, other filters than the mitchell filter (which is usually best) are also worth a try, "cubic" for example should rather closely match gimp's quality.

Well, I am no scirpt-fu expert, but I get a lot of mail that tells me that scirpt-fu simply doesn't work noninteractively, or at leats not correctly, or returns too earfly etc.. etc..

Ok, if script-fu is not meant to be run from the command line without interaction....then why the batch mode option?

from the gimp man pages.... -b, --batch
Execute the set of non-interactively. The set of is typically in the form of a script that can be executed by one of the Gimp scripting extensions.

Based on the documentation I have seen, I should be able to call a script-fu function and everything should work. That is not the case.

Attached is a cut down version of the script that I am attempting to call. I am calling this script from the command line as follows......

gimp -b '(script-fu-test-script 1 "200" "200" "/export/home/matt/toprocess/W-49M01_ven.jpg" "/export/home/matt/toprocess/W-49M01_ven_n.jpg")'

When this is run...I get back batch command: executed successfully.

However, there is no outputted image to be found. If I change the 1 to 0 to run interactivly, it pops up the prompt for me to enter in the values needed for the script and runs successfully. Is there any way of outputting what has been passed into a script?

Thoughts? Comments?

Matt Patterson matt@solinus.com

-- end forwarded message --