It is currently Sun Jun 30, 2024 1:48 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Running gimp script on file from win command line doesn't work
PostPosted: Fri Apr 28, 2017 8:53 am  (#1) 
Offline
New Member

Joined: Apr 28, 2017
Posts: 2
Hello,
i need this batch script to pass a jpeg to gimp console and run my script "CleanUpScan" on it.
The script also attempts to read the file and save it as .png.

The batch:
cd %~dp0
data\GIMPPortable\App\gimp\bin\gimp-2.8.exe -i -v -b '(CleanUpScan "C:\Users\C7X43T\Desktop\pngmin\CCI27042017.jpg")' -b '(gimp-quit 0)'
pause


CleanUpScan.scm as attachment.

Important snippets from the script:
Function header and variable declaration:
(define (CleanUpScan filename)
  (let* (   
         (img (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
            (nroflayers 0)
            (layers '())
            (height (car (gimp-image-height img)))
         (width (car (gimp-image-width img)))
            (index1 0)
         (y 0)
            (isCurrentLayerVisible #f)

        )

Saving the image as png:
;save image -> export as png
      ;get layer names (in an array)
       (set! layers (cadr (gimp-image-get-layers img)))
     (file-png-save2 0 img (aref layers 0) filename filename 0 9 1 0 0 1 0 0 1)

Problem: I suppose there is an issue with reading the file since the gimp process starts up and immediately shuts down.
Output on console:
(gimp-2.8.exe:8372): LibGimpBase-WARNING **: gimp-2.8.exe: gimp_wire_read(): error
batch command executed successfully



Attachment:
CleanUpScan.scm [6.5 KiB]
Downloaded 151 times


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Running gimp script on file from win command line doesn't work
PostPosted: Fri Apr 28, 2017 11:29 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
You can't use single-quotes on Windows command lines. Try this instead:

gimp-2.8.exe -i -v -b "(CleanUpScan \"C:\\Users\\C7X43T\\Desktop\\pngmin\\CCI27042017.jpg\")" -b "(gimp-quit 0)"


Top
 Post subject: Re: Running gimp script on file from win command line doesn't work
PostPosted: Sun Apr 30, 2017 10:07 am  (#3) 
Offline
New Member

Joined: Apr 28, 2017
Posts: 2
Thanks for your help,
this is how i got it to work:
cd %~dp0
"gimp-console-2.8" -b "(testloadsave \"C:\\Users\\C7X43T\\Desktop\\pngmin\\a.jpg\")" -b '(gimp-quit 0)'
pause
exit


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) 3D Wood This script doesn't work. Could someone repair it? Solved

16

No new posts How do you run GIMP from the command line?

1

No new posts Attachment(s) G'MIC> Pattern> Strip command line?

2

No new posts GEGL command line and layer modes?

2

No new posts Calling GIMP Plug-in From Command Line - on Windows

0



* Login  



Powered by phpBB3 © phpBB Group