batch processing

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

batch processing

Developers mailing list
I would like to batch process a directory of images to h=768 retain aspect
ratio.

I have not seen a simple way to do this.  Something like the wonderful
batch rename in Nautilus would be great if it exists or could be written.
[hidden email]
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: batch processing

Shlomi Fish
Hi Drake!

On Mon, 5 Oct 2020 11:39:20 -0500
Drake Koefoed via gimp-developer-list <[hidden email]> wrote:

> I would like to batch process a directory of images to h=768 retain aspect
> ratio.
>
> I have not seen a simple way to do this.  Something like the wonderful
> batch rename in Nautilus would be great if it exists or could be written.

This should be fairly easy to do using a script in python or similar. For some
resources for learning python, see:

*
https://github.com/shlomif/Freenode-programming-channel-FAQ/blob/master/FAQ_with_ToC__generated.md#i-want-to-learn-programming-which-language-should-i-start-with

* https://www.gimp.org/docs/

Hope that helps.

Regards,

        Shlomi Fish

> [hidden email]
> _______________________________________________
> gimp-developer-list mailing list
> List address:    [hidden email]
> List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> List archives:   https://mail.gnome.org/archives/gimp-developer-list



--

Shlomi Fish       https://www.shlomifish.org/
https://www.shlomifish.org/lecture/C-and-CPP/bad-elements/

“Did you sleep well?”
“No, I made a couple of mistakes.”
    — https://en.wikiquote.org/wiki/Steven_Wright via Nadav Har’El

Please reply to list if it's a mailing list post - https://shlom.in/reply .
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: batch processing

Kevin Cozens-2
In reply to this post by Developers mailing list
On 2020-10-05 12:39 p.m., Drake Koefoed via gimp-developer-list wrote:
> I would like to batch process a directory of images to h=768 retain aspect
> ratio.
>
> I have not seen a simple way to do this.

Have a look at ImageMagick.  Simpler solution if all you want to do is resize.

--
Cheers!

Kevin.

http://www.ve3syb.ca/               | "Nerds make the shiny things that
https://www.patreon.com/KevinCozens | distract the mouth-breathers, and
                                     | that's why we're powerful"
Owner of Elecraft K2 #2172          |
#include <disclaimer/favourite>     |             --Chris Hardwick
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: batch processing

Developers mailing list
I agree that simpler solutions exist using other tools, but I too found
myself trying to do batch conversion with Gimp on Windows for a very
specific project (I find that Gimp is often installed on Windows machines,
unlike other tools).

Here's a solution using batch and the scheme language.  It converts SVGs
but can be adapted.

https://superuser.com/a/1545028
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: batch processing

Developers mailing list
In reply to this post by Developers mailing list
If you're comfortable at the command-line, imagemagick is very simple
and runs everywhere:

https://imagemagick.org

With bash you can enter:

for i in *.jpg; do
    convert $i --resize x768 resized_version_$i
done

My image processing package nip2 can batch-process in a GUI way,
though it's a bizarre program.

https://github.com/libvips/nip2

1. Start nip2
2. Click "File / Open", navigate to the source directory, click on the
first image, shift-click on the last, click Open
3. This will make a group of images, probably called A1. "Click
Toolkits / Image / Transform / Resize / Size to" to resize the group
4. Select Vertical, 768, Lanczos3 in the scrap of GUI you see
5. RIght-click on the name of the resize object (probably A2) and
select "Save as"
6. In the dialog, navigate to a destination directory, enter eg.
"fred00.jpg" as the filename, and click Save
7. The set of images will be saved as fred00.jpg, fred01.jpg, fred02.jpg etc.

John


On Fri, 9 Oct 2020 at 11:26, Drake Koefoed via gimp-developer-list
<[hidden email]> wrote:

>
> I would like to batch process a directory of images to h=768 retain aspect
> ratio.
>
> I have not seen a simple way to do this.  Something like the wonderful
> batch rename in Nautilus would be great if it exists or could be written.
> [hidden email]
> _______________________________________________
> gimp-developer-list mailing list
> List address:    [hidden email]
> List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> List archives:   https://mail.gnome.org/archives/gimp-developer-list
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: batch processing

Shlomi Fish
Hi jcupitt !

On Sat, 10 Oct 2020 17:05:18 +0100
jcupitt--- via gimp-developer-list <[hidden email]> wrote:

> If you're comfortable at the command-line, imagemagick is very simple
> and runs everywhere:
>
> https://imagemagick.org
>
> With bash you can enter:
>
> for i in *.jpg; do
>     convert $i --resize x768 resized_version_$i
> done

It is a good idea to wrap the $i in double quotes in bash and similar shells to
prevent word splitting:

* https://shlomif-tech.livejournal.com/14671.html

* https://perl-begin.org/topics/security/code-markup-injection/

>
> My image processing package nip2 can batch-process in a GUI way,
> though it's a bizarre program.
>
> https://github.com/libvips/nip2
>

Heh, it is nice that you admit that you think it is "bizarre". It shows
maturity to admit that one's software application is not perfect.

> 1. Start nip2
> 2. Click "File / Open", navigate to the source directory, click on the
> first image, shift-click on the last, click Open
> 3. This will make a group of images, probably called A1. "Click
> Toolkits / Image / Transform / Resize / Size to" to resize the group
> 4. Select Vertical, 768, Lanczos3 in the scrap of GUI you see
> 5. RIght-click on the name of the resize object (probably A2) and
> select "Save as"
> 6. In the dialog, navigate to a destination directory, enter eg.
> "fred00.jpg" as the filename, and click Save
> 7. The set of images will be saved as fred00.jpg, fred01.jpg, fred02.jpg etc.
>
> John
>
>
> On Fri, 9 Oct 2020 at 11:26, Drake Koefoed via gimp-developer-list
> <[hidden email]> wrote:
> >
> > I would like to batch process a directory of images to h=768 retain aspect
> > ratio.
> >
> > I have not seen a simple way to do this.  Something like the wonderful
> > batch rename in Nautilus would be great if it exists or could be written.
> > [hidden email]
> > _______________________________________________
> > gimp-developer-list mailing list
> > List address:    [hidden email]
> > List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> > List archives:   https://mail.gnome.org/archives/gimp-developer-list 
> _______________________________________________
> gimp-developer-list mailing list
> List address:    [hidden email]
> List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> List archives:   https://mail.gnome.org/archives/gimp-developer-list



--

Shlomi Fish       https://www.shlomifish.org/
https://youtu.be/n6KAGqjdmsk - “Hurt Me Tomorrow”

I also have versions of this code in COBOL.NET, Intercal, PDP‐10 Assembly, J,
APL, Windows NT 4.0 Batch script and Autocad Lisp — I’m sure you can handle
all of them because none of them is Perl. ;-).

Please reply to list if it's a mailing list post - https://shlom.in/reply .
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: batch processing

Developers mailing list
Imagemagick has a batch mode called "mogrify" so you can just use something
like this from the command line:

mogrify -format jpg -resize 3000 -define jpeg:extent=1000kb *.jpg

That will resize all jpegs in the directory to 3000px (height or width,
whichever is larger) and it will try to get close to 1000kb for the file
size.

For your use case you could also do:

mogrify -format jpg -resize 750 -quality 80 *.jpg

Hope it helps!

Note also that nautilus has the ability to be scripted with these commands
to execute on what you have selected.

I believe there is also already a script written for this to:


Install rotate and resize right-click functions:

sudo apt-get install nautilus-image-converter

restart of nautilus required


-C

On Sun, 11 Oct 2020, 06:41 Shlomi Fish, <[hidden email]> wrote:

> Hi jcupitt !
>
> On Sat, 10 Oct 2020 17:05:18 +0100
> jcupitt--- via gimp-developer-list <[hidden email]> wrote:
>
> > If you're comfortable at the command-line, imagemagick is very simple
> > and runs everywhere:
> >
> > https://imagemagick.org
> >
> > With bash you can enter:
> >
> > for i in *.jpg; do
> >     convert $i --resize x768 resized_version_$i
> > done
>
> It is a good idea to wrap the $i in double quotes in bash and similar
> shells to
> prevent word splitting:
>
> * https://shlomif-tech.livejournal.com/14671.html
>
> * https://perl-begin.org/topics/security/code-markup-injection/
>
> >
> > My image processing package nip2 can batch-process in a GUI way,
> > though it's a bizarre program.
> >
> > https://github.com/libvips/nip2
> >
>
> Heh, it is nice that you admit that you think it is "bizarre". It shows
> maturity to admit that one's software application is not perfect.
>
> > 1. Start nip2
> > 2. Click "File / Open", navigate to the source directory, click on the
> > first image, shift-click on the last, click Open
> > 3. This will make a group of images, probably called A1. "Click
> > Toolkits / Image / Transform / Resize / Size to" to resize the group
> > 4. Select Vertical, 768, Lanczos3 in the scrap of GUI you see
> > 5. RIght-click on the name of the resize object (probably A2) and
> > select "Save as"
> > 6. In the dialog, navigate to a destination directory, enter eg.
> > "fred00.jpg" as the filename, and click Save
> > 7. The set of images will be saved as fred00.jpg, fred01.jpg, fred02.jpg
> etc.
> >
> > John
> >
> >
> > On Fri, 9 Oct 2020 at 11:26, Drake Koefoed via gimp-developer-list
> > <[hidden email]> wrote:
> > >
> > > I would like to batch process a directory of images to h=768 retain
> aspect
> > > ratio.
> > >
> > > I have not seen a simple way to do this.  Something like the wonderful
> > > batch rename in Nautilus would be great if it exists or could be
> written.
> > > [hidden email]
> > > _______________________________________________
> > > gimp-developer-list mailing list
> > > List address:    [hidden email]
> > > List membership:
> https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> > > List archives:   https://mail.gnome.org/archives/gimp-developer-list
> > _______________________________________________
> > gimp-developer-list mailing list
> > List address:    [hidden email]
> > List membership:
> https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> > List archives:   https://mail.gnome.org/archives/gimp-developer-list
>
>
>
> --
>
> Shlomi Fish       https://www.shlomifish.org/
> https://youtu.be/n6KAGqjdmsk - “Hurt Me Tomorrow”
>
> I also have versions of this code in COBOL.NET, Intercal, PDP‐10
> Assembly, J,
> APL, Windows NT 4.0 Batch script and Autocad Lisp — I’m sure you can handle
> all of them because none of them is Perl. ;-).
>
> Please reply to list if it's a mailing list post - https://shlom.in/reply
> .
> _______________________________________________
> gimp-developer-list mailing list
> List address:    [hidden email]
> List membership:
> https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> List archives:   https://mail.gnome.org/archives/gimp-developer-list
>
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list