It is currently Tue Mar 19, 2024 9:00 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: "Alpha" bash script/method to batch-crop images on GIMP + ImageMagick
PostPosted: Sat Dec 09, 2017 5:40 pm  (#1) 
Offline
GimpChat Member

Joined: Aug 17, 2013
Posts: 8
Okay, I'm a noob, just like my nickname says, and therefore I can't post the copy of explanation I've posted elsewhere, but I think it may interest some GIMP users, even if it's somewhat "spammy".

If you have tons of pictures to crop, and cropping them don't require pixel-perfect precision, you could save time by just painting over a gallery of thumbnails, roughly covering the borders or key interest areas to be cropped/preserved. It can be either with filled rectangles, or just loose squiggles with the pencil or ink tools (the harder the brush, the better, I suppose).

So, this preliminary script already allows you to do that. First you have to put all the images to be cropped in a folder (with just those images), and then create an ImageMagick "montage" of the pictures to be cropped. You'll open this montage on GIMP, where you do your selection/crop marks on a transparent layer over it.

What the script uses is this layer with the marks, saved isolated as a png.

It's quite analog to painting said squiggles or marks on a different layer, over a single image, leaving on only the opacity of this squiggle/rectangle layer, and then performing GIMP's "autocrop image", then switching the opacity of the layers again. While this process doesn't make much sense for a single image, I feel it's quite handier to crop a ton of images, over the thumbnail composite.


tl;dr: Googling "Batch-cropping with ImageMagick + GIMP. Script helper(s), in development" should bring as the first result a blog post on "linuxquestions", which in turn has a link to the original post on the ImageMagick's forums, which apparently isn't listed in google yet. On either of them there are some illustrations of how it goes, and the code itself.


It's pretty rudimentary (and quite small, really, even though it's more ugly than it's small), and, even though it does "the main thing", it still has some small temporary file leftovers and whatnot (220x220px gifs, one for each image cropped).



I thought of posting it here because perhaps there are more people than me who'd like to use this method, including people who can actually code those GIMP's "add-ons" that would make the whole process even more streamlined.

Sometime along the way there may be some improvements on the syntax of imagemagick's commands, which I suspect isn't the most efficient possible right now.


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: "Alpha" bash script/method to batch-crop images on GIMP + ImageMag
PostPosted: Sun Dec 10, 2017 6:28 am  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4726
noob wrote:
tl;dr: Googling "Batch-cropping with ImageMagick + GIMP. Script helper(s), in development" should bring as the first result a blog post on "linuxquestions", which in turn has a link to the original post on the ImageMagick's forums, which apparently isn't listed in google yet. On either of them there are some illustrations of how it goes, and the code itself.


Wouldn't it be much simpler if you posted the URL? even with some asterisks id you aren't allowed to post URLs: "h*t*t*p*://google.com/"

_________________
Image


Top
 Post subject: Re: "Alpha" bash script/method to batch-crop images on GIMP + ImageMag
PostPosted: Sun Dec 10, 2017 7:23 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 06, 2017
Posts: 204
I tried Googling that search term but there was no "linuxquestions" forum to be seen, the first entry that I clicked on redirected me (or tried to) to somewhere else... ..editing wrong post here oopsie,...


Last edited by Zero01 on Mon Dec 11, 2017 3:01 pm, edited 2 times in total.

Top
 Post subject: Re: "Alpha" bash script/method to batch-crop images on GIMP + ImageMag
PostPosted: Sun Dec 10, 2017 9:31 am  (#4) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2414
guessing the OP does not have enough posts to permit posting URLs

this one

https://www.linuxquestions.org/question ... ent-37634/

and a link in that to

https://www.imagemagick.org/discourse-s ... =1&t=33209

_________________
Image


Top
 Post subject: Re: "Alpha" bash script/method to batch-crop images on GIMP + ImageMag
PostPosted: Sun Dec 10, 2017 10:43 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 06, 2017
Posts: 204
OK thanks will have to try this, looks cool.


Top
 Post subject: Re: "Alpha" bash script/method to batch-crop images on GIMP + ImageMag
PostPosted: Thu Dec 14, 2017 3:33 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Jan 06, 2017
Posts: 204
Gave up, got too many errors, didn't really know whether I was doing everything correctly anyway!


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) converting 32 bit images to 8 bit using batch script

5

No new posts Attachment(s) Batch export all opened images script for GIMP [Update]

13

No new posts Attachment(s) GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugin

86

No new posts Attachment(s) Clipping and Alpha using two generated source images

7

No new posts Attachment(s) Shortening mouse/keystrokes save/export script or method to implement?

41



* Login  



Powered by phpBB3 © phpBB Group