Bitcoin Forum
May 17, 2024, 07:16:10 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help me with GIMP (0.025BTC reward)  (Read 583 times)
CatsLikeToStretch (OP)
Newbie
*
Offline Offline

Activity: 31
Merit: 0


View Profile
April 29, 2016, 03:42:13 PM
 #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.
ChasingCarsEU
Full Member
***
Offline Offline

Activity: 154
Merit: 100

ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6


View Profile
April 29, 2016, 03:51:05 PM
 #2

Sending you a PM!

sparkyhack
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
April 29, 2016, 03:57:02 PM
 #3

is it not batch resize you need to use

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

Activity: 154
Merit: 100

ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6


View Profile
April 29, 2016, 03:58:41 PM
 #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!

CatsLikeToStretch (OP)
Newbie
*
Offline Offline

Activity: 31
Merit: 0


View Profile
April 29, 2016, 04:01:12 PM
 #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.
arwin100
Hero Member
*****
Offline Offline

Activity: 2744
Merit: 810


Jack of all trades 💯


View Profile WWW
April 29, 2016, 04:02:37 PM
Last edit: April 29, 2016, 04:22:36 PM by arwin100
 #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.

ChasingCarsEU
Full Member
***
Offline Offline

Activity: 154
Merit: 100

ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6


View Profile
April 29, 2016, 04:04:18 PM
 #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)'

pedrog
Legendary
*
Offline Offline

Activity: 2786
Merit: 1031



View Profile
April 29, 2016, 04:05:57 PM
 #8

If you have ImageMagik installed you can simply:

Code:
convert '*.jpg[500x]' resized%03d.jpg

CatsLikeToStretch (OP)
Newbie
*
Offline Offline

Activity: 31
Merit: 0


View Profile
April 29, 2016, 04:15:50 PM
 #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.
CatsLikeToStretch (OP)
Newbie
*
Offline Offline

Activity: 31
Merit: 0


View Profile
April 29, 2016, 04:19:57 PM
 #10

Nevermind, I had *.JPG, but all of my files are .jpg (lowercase).

Now it works.

Chasing cars - please provide your address.

Thanks.
arwin100
Hero Member
*****
Offline Offline

Activity: 2744
Merit: 810


Jack of all trades 💯


View Profile WWW
April 29, 2016, 04:20:57 PM
 #11

All of above giving comments?

ChasingCarsEU
Full Member
***
Offline Offline

Activity: 154
Merit: 100

ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6


View Profile
April 29, 2016, 04:21:38 PM
 #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

CatsLikeToStretch (OP)
Newbie
*
Offline Offline

Activity: 31
Merit: 0


View Profile
April 29, 2016, 04:32:47 PM
 #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. 
ChasingCarsEU
Full Member
***
Offline Offline

Activity: 154
Merit: 100

ARgRd5YDR199ZpCs9wjtjhxfDzN6vpDHq6


View Profile
April 29, 2016, 04:34:22 PM
 #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!

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!