Author

Topic: Help me with GIMP (0.025BTC reward) (Read 602 times)

full member
Activity: 154
Merit: 100
ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6
April 29, 2016, 11:34:22 AM
#14
0.025002 BTC has been sent to ChasingCars - thanks for your help.

Arwin, I appreciate the help, but in the OP I specifically said I wanted to use the command line. 

Got the money!

Thank you so much! Smiley

Cheers!
newbie
Activity: 31
Merit: 0
April 29, 2016, 11:32:47 AM
#13
0.025002 BTC has been sent to ChasingCars - thanks for your help.

Arwin, I appreciate the help, but in the OP I specifically said I wanted to use the command line. 
full member
Activity: 154
Merit: 100
ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6
April 29, 2016, 11:21:38 AM
#12
Nevermind, I had *.JPG, but all of my files are .jpg (lowercase).

Now it works.

Chasing cars - please provide your address.

Thanks.

Great to know I could help you out!

My bitcoin address is: 19KAFrMRDJtbHvFqoHDxZicp1iWkCWMbMk

Thank you so much for the opportunity!

Cheers Smiley
hero member
Activity: 2632
Merit: 787
Jack of all trades 💯
April 29, 2016, 11:20:57 AM
#11
All of above giving comments?
newbie
Activity: 31
Merit: 0
April 29, 2016, 11:19:57 AM
#10
Nevermind, I had *.JPG, but all of my files are .jpg (lowercase).

Now it works.

Chasing cars - please provide your address.

Thanks.
newbie
Activity: 31
Merit: 0
April 29, 2016, 11:15:50 AM
#9
(define (batch-resize pattern width height)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-image-scale-full image width height INTERPOLATION-CUBIC)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))

This particular script takes a pattern for filename, desired width and height as inputs and resize all image files that are matched. This script overwrites the existing file. In order to run the script, save it with .scm extension in the ~/.gimp-/scripts/ directory.

Then goto the directory which contains images, then run the following command to resize images:

gimp -i -b '(batch-resize "./pics/*.jpg" 500 500)' -b '(gimp-quit 0)'

That runs fine, but it doesnt actually change the pictures.  They are still the same size.

Quote
desktop@desktop-desktop:~/pics$ ls -l
total 5740
-rw-rw-r-- 1 desktop desktop 1948380 Apr 28 01:30 00001833.jpg
-rw-rw-r-- 1 desktop desktop 1948405 Apr 28 01:30 00001834.jpg
-rw-rw-r-- 1 desktop desktop 1951488 Apr 28 01:30 00001835.jpg
desktop@desktop-desktop:~/pics$ gimp -i -b '(batch-resize "*.JPG" 500 500)' -b '(gimp-quit 0)'
batch command executed successfully
desktop@desktop-desktop:~/pics$ ls -l
total 5740
-rw-rw-r-- 1 desktop desktop 1948380 Apr 28 01:30 00001833.jpg
-rw-rw-r-- 1 desktop desktop 1948405 Apr 28 01:30 00001834.jpg
-rw-rw-r-- 1 desktop desktop 1951488 Apr 28 01:30 00001835.jpg
desktop@desktop-desktop:~/pics$

To the later two posters, I dont want to use imagemagik and I don't want to use the GIMP gui.  I want to do this using GIMP from the command line.
legendary
Activity: 2786
Merit: 1031
April 29, 2016, 11:05:57 AM
#8
If you have ImageMagik installed you can simply:

Code:
convert '*.jpg[500x]' resized%03d.jpg
full member
Activity: 154
Merit: 100
ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6
April 29, 2016, 11:04:18 AM
#7
(define (batch-resize pattern width height)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-image-scale-full image width height INTERPOLATION-CUBIC)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))

This particular script takes a pattern for filename, desired width and height as inputs and resize all image files that are matched. This script overwrites the existing file. In order to run the script, save it with .scm extension in the ~/.gimp-/scripts/ directory.

Then goto the directory which contains images, then run the following command to resize images:

gimp -i -b '(batch-resize "./pics/*.jpg" 500 500)' -b '(gimp-quit 0)'
hero member
Activity: 2632
Merit: 787
Jack of all trades 💯
April 29, 2016, 11:02:37 AM
#6
Try  this:
Code:
sudo apt-get install gimp-plugin-registry

Then, open up Gimp and open the Batch plugin found in Filters > Batch > Batch Process.

Select your images in the Input tab, and define the Resize operation in the surprisingly-named Resize tab.
newbie
Activity: 31
Merit: 0
April 29, 2016, 11:01:12 AM
#5
Thanks to both of you, but I still get the same error.

Quote
desktop@desktop-desktop:~/pics$ gimp -i -b '(batch-resize "/pics/*.jpg" 500 500)' -b '(gimp-quit 0)'
batch command experienced an execution error:
Error: ( : 1) eval: unbound variable: batch-resize

Quote
desktop@desktop-desktop:~/pics$ gimp -i -b '(batch-resize "./pics/*.jpg" 500 500)' -b '(gimp-quit 0)'
batch command experienced an execution error:
Error: ( : 1) eval: unbound variable: batch-resize

and you can see I do have images in the directory:

Quote
desktop@desktop-desktop:~/pics$ ls
00001833.jpg  00001834.jpg  00001835.jpg
desktop@desktop-desktop:~/pics$

Also - post your address so I can pay.
full member
Activity: 154
Merit: 100
ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6
April 29, 2016, 10:58:41 AM
#4
is it not batch resize you need to use

Code:
gimp -i -b '(batch-resize "./pics/*.jpg" 500 500)' -b '(gimp-quit 0)'

Yeah, this is it.

Was about to post it but I guess you got here first, damn.

Well, at least you've worked it out, cheers!
newbie
Activity: 4
Merit: 0
April 29, 2016, 10:57:02 AM
#3
is it not batch resize you need to use

Code:
gimp -i -b '(batch-resize "./pics/*.jpg" 500 500)' -b '(gimp-quit 0)'
full member
Activity: 154
Merit: 100
ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6
April 29, 2016, 10:51:05 AM
#2
Sending you a PM!
newbie
Activity: 31
Merit: 0
April 29, 2016, 10:42:13 AM
#1
I am running ubuntu.  I have a directory with many jpgs in it, they are all the same size.  I want to resize all of them to 500 x 500 pixels.

I want to use GIMP command line functions. 

The files are in  /pics

I am trying:

Quote
gimp -i -b '(gimp-image-scale "./pics/*.jpg" 500 500)' -b '(gimp-quit 0)'

The error I get is:

Quote
batch command experienced an execution error:
Error: ( : 1) Invalid type for argument 1 to gimp-image-scale

Surely I am doing something stupid and I am willing to pay someone 0.025BTC to help me, I've already wasted too much time on this. 

Check my posting history, I have paid many rewards in the past for help like this.
Jump to: