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

problem with image conversion script

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.

8 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

problem with image conversion script Octavi Fors 06 Apr 21:31
  problem with image conversion script Kevin Cozens 06 Apr 23:17
   problem with image conversion script Sven Neumann 06 Apr 23:54
    problem with image conversion script Octavi Fors 07 Apr 09:32
  problem with image conversion script Pere Pujal i Carabantes 07 Apr 12:59
   problem with image conversion script Octavi Fors 07 Apr 13:27
    problem with image conversion script Pere Pujal i Carabantes 07 Apr 17:42
     problem with image conversion script Octavi Fors 07 Apr 17:47
Octavi Fors
2008-04-06 21:31:26 UTC (almost 17 years ago)

problem with image conversion script

Hi everybody,

I want to convert a FITS image into PPM in batch mode. Grabbing code from different sites I end up to a source script version like this:

(define (fits-to-ppm infile outfile)
(let* ((image (car (file-fits-load
RUN-NONINTERACTIVE
infile
infile
)
)
(drawable (car (gimp-image-get-active-layer image)))) (file-ppm-save RUN-NONINTERACTIVE image drawable outfile outfile 0) (gimp-image-delete image)
)
)
)

When I run this in the command line (in the same directory where "mask.fits" reides) I get this result:

$ gimp -i -b '( fits-to-ppm "mask.fits" "mask.ppm")' '(gimp-quit 0)' No batch interpreter specified, using the default 'plug_in_script_fu_eval'. batch command: executed successfully.

However, no file "mask.ppm" appears in the directory where I'm executing gimp :-(

Any ideas what's going on? Whatever comments/hint will be very welcome.

Thanks in advance,

Octavi.

Kevin Cozens
2008-04-06 23:17:54 UTC (almost 17 years ago)

problem with image conversion script

Octavi Fors wrote:

I want to convert a FITS image into PPM in batch mode.

[snip]

When I run this in the command line (in the same directory where "mask.fits" reides) I get this result:

[snip]

However, no file "mask.ppm" appears in the directory where I'm executing gimp :-(

Your users current directory and GIMP's default directory aren't necessarily the same. Include the directory name in the name of the files.

Sven Neumann
2008-04-06 23:54:18 UTC (almost 17 years ago)

problem with image conversion script

Hi,

On Sun, 2008-04-06 at 17:17 -0400, Kevin Cozens wrote:

Your users current directory and GIMP's default directory aren't necessarily the same.

They are the same. The GIMP process doesn't change the current working directory and it uses it as the default directory when saving. So do the plug-ins, at least the ones that are distributed with GIMP.

Sven

Octavi Fors
2008-04-07 09:32:04 UTC (almost 17 years ago)

problem with image conversion script

still no output file even when including the directory name in the name of the files...

Can this silent error have to do with the fact that gimp asks Blank/Nan value" and "Pixel value scaling" when loading the FITS image (which I'm attaching to the message)?

Best regards,

Octavi.

On Sun, Apr 6, 2008 at 11:54 PM, Sven Neumann wrote:

Hi,

On Sun, 2008-04-06 at 17:17 -0400, Kevin Cozens wrote:

Your users current directory and GIMP's default directory aren't

necessarily

the same.

They are the same. The GIMP process doesn't change the current working directory and it uses it as the default directory when saving. So do the plug-ins, at least the ones that are distributed with GIMP.

Sven

_______________________________________________ Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Pere Pujal i Carabantes
2008-04-07 12:59:23 UTC (almost 17 years ago)

problem with image conversion script

Hola Octavi!

El dg 06 de 04 del 2008 a les 19:31 +0000, en/na Octavi Fors va escriure:

I want to convert a FITS image into PPM in batch mode. Grabbing code from different sites I end up to a source script version like this:

(define (fits-to-ppm infile outfile)
(let* ((image (car (file-fits-load
RUN-NONINTERACTIVE
infile
infile
)
)

; Here you lack a ) closing (image

(drawable (car (gimp-image-get-active-layer image))))
(file-ppm-save RUN-NONINTERACTIVE image drawable outfile outfile 0) (gimp-image-delete image)
)
)

Here you should remove the ) added before

)

Thanks in advance,

Octavi.

Hope this helps
Pere

Octavi Fors
2008-04-07 13:27:38 UTC (almost 17 years ago)

problem with image conversion script

Thanks Pere!

the script worked fine once I included your tip. I'm surprised gimp interpreter didn't warn that...

Anyway, now the output "mask_gimp.ppm" file is generated. However, this is a greyscale one in ASCII (magic number is P2) and would like to output a color one in ASCII (magic number is P3).
Can I also do this in the same script below?

(define (fits-to-ppm infile outfile)
(let* ((image (car (file-fits-load RUN-NONINTERACTIVE infile
infile
)
)
)
(drawable (car (gimp-image-get-active-layer image))) )
(file-ppm-save RUN-NONINTERACTIVE image drawable outfile outfile 0) (gimp-image-delete image)
)
)

Any help on this will be very welcome.

Regards,

Octavi.

On Mon, Apr 7, 2008 at 12:59 PM, Pere Pujal i Carabantes < pere@fornol.no-ip.org> wrote:

Hola Octavi!

El dg 06 de 04 del 2008 a les 19:31 +0000, en/na Octavi Fors va escriure:

I want to convert a FITS image into PPM in batch mode. Grabbing code from different sites I end up to a source script version like this:

(define (fits-to-ppm infile outfile)
(let* ((image (car (file-fits-load
RUN-NONINTERACTIVE
infile
infile
)
)

; Here you lack a ) closing (image

(drawable (car (gimp-image-get-active-layer image))))

(file-ppm-save RUN-NONINTERACTIVE image drawable outfile outfile 0) (gimp-image-delete image)
)
)

Here you should remove the ) added before

)

Thanks in advance,

Octavi.

Hope this helps
Pere

Pere Pujal i Carabantes
2008-04-07 17:42:55 UTC (almost 17 years ago)

problem with image conversion script

Hola Octavi!

El dl 07 de 04 del 2008 a les 13:27 +0200, en/na Octavi Fors va escriure:

Anyway, now the output "mask_gimp.ppm" file is generated. However, this is a greyscale one in ASCII (magic number is P2) and would like to output a color one in ASCII (magic number is P3).

You should insert a (gimp-image-convert-rgb image) before saving.

Salut Pere

Octavi Fors
2008-04-07 17:47:15 UTC (almost 17 years ago)

problem with image conversion script

Pere,

yes! It worked. The script is:

(define (fits-to-ppm infile outfile) (let* ((image (car (file-fits-load RUN-NONINTERACTIVE infile infile))) (drawable (car (gimp-image-get-active-layer image))) )
(gimp-image-convert-rgb image)
(file-ppm-save RUN-NONINTERACTIVE image drawable outfile outfile 0) (gimp-image-delete image)
)
)

Thanks so much for helping,

Octavi.

On Mon, Apr 7, 2008 at 5:42 PM, Pere Pujal i Carabantes < pere@fornol.no-ip.org> wrote:

Hola Octavi!

El dl 07 de 04 del 2008 a les 13:27 +0200, en/na Octavi Fors va escriure:

Anyway, now the output "mask_gimp.ppm" file is generated. However, this is a greyscale one in ASCII (magic number is P2) and would like to output a color one in ASCII (magic number is P3).

You should insert a (gimp-image-convert-rgb image) before saving.

Salut Pere