GT Portal . Forums . Official Tutorials . Art Galleries . FAQs . Search . New Posts . Contact Us Login  .  Register


Board index » GIMP Art Galleries and Resources » GIMP Plugins, Filters, and Scripts Make Money Online . Free Image Hosting
Featured Tutorial : Learn how to create characters by Griatch
Search for :  


Post new topic Reply to topic   [ 2 posts ]  


Author Message
 Post subject:
PostPosted: Sat May 03, 2008 3:38 pm 
Offline
User avatar

Joined:
Sat May 03, 2008 3:29 pm

Topics: 1
Posts: 1

Find User's Topics

Greetings,

I am using Kubuntu (Linux) and in it Gimp, of course.
As a photographer I handle hundreds of photos a day.

Often, after cropping and setting the white balance, I do "automatically" the followings:
1. set the image size (so the with is max 700, the height is max 500)
2. set the canvas size to exactly 700x500, where the image is centered (and the background id a given color, for example black)
3. save the file

This is mechanical, and it would be nice to have a sript to do it.

Well, I am new in this filed, this would be my first script.

Please, help me ... with a script what can do the above... and some idea, how can I modify it, eventually, how may I write a new script... if and when needed...

Oh, yes... and another question.
If I have a folder full with images... and I would like to run this new sript on all of the files... how can I do it?

Thanks a lot,

Tamas




Top
 Profile  
 
 Post subject:
PostPosted: Wed May 07, 2008 12:23 pm 
Online
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics: 76
Posts: 3454

Find User's Topics
I would recommend reading about Script-fu in the GIMP Users Manual. I will provide some hints to resolving some of the specific tasks, but you will have to combine them yourself. Feel free to ask questions; I just don't wish rehash stuff that is already covered elsewhere (in particular, how to register your Script-fu in the menus).

Quote:
1. set the image size (so the with is max 700, the height is max 500)


Code:
   (let* (
         (width  (car (gimp-image-width image)))
         (height (car (gimp-image-height image)))
         )
      (if (> (/ width height) (/ 700 500))
         (gimp-image-scale image 700 (* height (/ width 500)))
         (gimp-image-scale image (* width (/ 500 height)) 500)
         )
      )


Quote:
2. set the canvas size to exactly 700x500, where the image is centered (and the background id a given color, for example black)

Code:
   (gimp-image-resize image 700 500
      (/ (- 700  (car (gimp-image-width image))) 2)
      (/ (- 500   (car (gimp-image-height image))) 2)
      )
   (gimp-context-set-background '( 0 0 0))
   (gimp-image-flatten image)


Saving the file is better covered in other tutorials.


_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Profile  
 
Display posts from previous:  Sort by  

Post new topic Reply to topic
 [ 2 posts ] 



Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Related Website
Gimp tutorials database
All rights reserved © GimpTalk 2008
forum software by
phpBB