Post Reply 

batch-scale-level-sharpen from command line in Windows and MacOS

Oct 10, 2014, 15:27
Post: #1
batch-scale-level-sharpen from command line in Windows and MacOS
I have always been a big fan of the batch-scale-level-sharpen plugin, [url=http://registry.gimp.org/node/25350]. Apart from anything else, I use it to scale and recode by raw camera images for more general consumption.

Just today, I went through the labour of making this work from the command line, first in MacOSx, then in Windows.

First install the plugin, by downloading and copying the file to one of the library directories listed in File -> Preference -> Files

I am using 2.8.14 on both. On MacOSx I had to work around some library load path bug, in Windows to struggle with character escaping with CMD.EXE . Never the less, I now have both working & would like to share this.

The error I saw in MacOSx was:

dyld: Library not loaded: @executable_path/../Resources/lib/libgimpui-2.0.0.dylib

(for the benefit of Google)

The solution was to add a path to an environment variable. The outcome so:

Quote:davesimac:MacOS dave$ ls -l ~/Pictures/*.jpg
-rw-r--r--@ 1 dave staff 90672 18 Nov 2013 /Users/dave/Pictures/Blood.jpg
-rw-r--r--@ 1 dave staff 1981253 21 Jan 2014 /Users/dave/Pictures/IMG_0208.jpg
-rw-r--r--@ 1 dave staff 1899883 21 Jan 2014 /Users/dave/Pictures/IMG_0226.jpg
-rw-r--r--@ 1 dave staff 105567 1 May 17:38 /Users/dave/Pictures/usdollar.jpg
davesimac:MacOS dave$ DYLD_LIBRARY_PATH=/Applications/GIMP.app/Contents/Resources/lib:$DYLD_LIBRARY_PATH /Applications/GIMP.app/Contents/MacOS/GIMP-bin -i -f -d -s -b '(script-fu-batch-sls "/Users/dave/Pictures/*.jpg" "_small.jpg" 0.50 FALSE FALSE FALSE FALSE FALSE)' -b '(gimp-quit 0)'
While parsing XMP metadata:
Error: No XMP packet found
While parsing XMP metadata:
Error: No XMP packet found
While parsing XMP metadata:
Error on line 36 char 1: End of element not expected in this context

Metadata parasite seems to be corrupt
While parsing XMP metadata:
Error on line 2 char 1: Nested elements () are not allowed in this context

** (file-jpeg:70911): WARNING **: JPEG - unable to decode XMP metadata packet
While parsing XMP metadata:
Error: No XMP packet found
While parsing XMP metadata:
Error on line 36 char 1: End of element not expected in this context

Metadata parasite seems to be corrupt
While parsing XMP metadata:
Error on line 2 char 1: Nested elements () are not allowed in this context

** (file-jpeg:70916): WARNING **: JPEG - unable to decode XMP metadata packet
batch command executed successfully
davesimac:MacOS dave$ ls -l ~/Pictures/*.jpg
-rw-r--r--@ 1 dave staff 90672 18 Nov 2013 /Users/dave/Pictures/Blood.jpg
-rw-r--r-- 1 dave staff 34257 10 Oct 15:20 /Users/dave/Pictures/Blood_small.jpg
-rw-r--r--@ 1 dave staff 1981253 21 Jan 2014 /Users/dave/Pictures/IMG_0208.jpg
-rw-r--r-- 1 dave staff 552815 10 Oct 15:21 /Users/dave/Pictures/IMG_0208_small.jpg
-rw-r--r--@ 1 dave staff 1899883 21 Jan 2014 /Users/dave/Pictures/IMG_0226.jpg
-rw-r--r-- 1 dave staff 516620 10 Oct 15:21 /Users/dave/Pictures/IMG_0226_small.jpg
-rw-r--r--@ 1 dave staff 105567 1 May 17:38 /Users/dave/Pictures/usdollar.jpg
-rw-r--r-- 1 dave staff 38920 10 Oct 15:21 /Users/dave/Pictures/usdollar_small.jpg
davesimac:MacOS dave$
Then in windows it is just a matter of escaping " and \ , so:

Quote:C:\Users\dave>dir c:\Users\dave\Pictures\*.jpeg
Volume in drive C has no label.
Volume Serial Number is 1E64-332C

Directory of c:\Users\dave\Pictures

05/09/2013 19:01 1,157,644 DSC_1736_h - Copy.jpeg
05/09/2013 19:02 1,166,641 DSC_1739_h - Copy.jpeg
05/09/2013 19:04 1,246,957 DSC_1750_h - Copy.jpeg
05/09/2013 19:07 1,004,919 DSC_1763_h - Copy.jpeg
09/07/2013 07:51 740,018 mickbewl.jpeg
5 File(s) 5,316,179 bytes
0 Dir(s) 51,323,703,296 bytes free

C:\Users\dave>"\Program Files\GIMP 2\bin\gimp-2.8.exe" -i -f -d -b "(script-fu-batch-sls \"C:\\Users\\dave\\Pictures\\*.jpeg\" \"_small.jpeg\" 0.50 FALSE FALSE FALSE FALSE FALSE)" -b "(gimp-quit 0)"

C:\Users\dave>dir c:\Users\dave\Pictures\*.jpeg
Volume in drive C has no label.
Volume Serial Number is 1E64-332C

Directory of c:\Users\dave\Pictures

05/09/2013 19:01 1,157,644 DSC_1736_h - Copy.jpeg
10/10/2014 15:57 378,459 DSC_1736_h - Copy_small.jpeg
05/09/2013 19:02 1,166,641 DSC_1739_h - Copy.jpeg
10/10/2014 15:57 380,694 DSC_1739_h - Copy_small.jpeg
05/09/2013 19:04 1,246,957 DSC_1750_h - Copy.jpeg
10/10/2014 15:57 349,317 DSC_1750_h - Copy_small.jpeg
05/09/2013 19:07 1,004,919 DSC_1763_h - Copy.jpeg
10/10/2014 15:57 321,902 DSC_1763_h - Copy_small.jpeg
09/07/2013 07:51 740,018 mickbewl.jpeg
10/10/2014 15:57 226,079 mickbewl_small.jpeg
10 File(s) 6,972,630 bytes
0 Dir(s) 51,321,446,400 bytes free

C:\Users\dave>

I hope that this helps others, my earlier Googling had failed to help with the problems in either environment.

ATB
Find all posts by this user
Quote this message in a reply
Oct 10, 2014, 15:51
Post: #2
RE: batch-scale-level-sharpen from command line in Windows and MacOS
With ImageMagick (available on Windows, OSX, Linux,...):
Code:
mogrify -sharpen 0x1.0 *.jpg

There is also a "convert" command that does the same thing but writes to another image.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  scale tool not correct Archer 0 693 Nov 20, 2010 11:18
Last Post: Archer

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS