Re: [Gimp-developer] Asking for help/collaboration in nonprofit mini-project around covid-19



On Fri, May 01, 2020 at 11:21:18PM +0200, Ofnuts wrote:
On 01/05/2020 22:40, P. Cáliz wrote:
Hi all

    I am trying to launch a social (non-profit) mini-project based on the
hashtag #EstasEnMisPensamientos / #YouAreOnMyMind.
    I am going to publicly share a selection of my photos (a few hundred, I
suppose there will be some good ones ;-) ) labeled with that hastag and
with the URL of the collection, so that anyone can freely send them to
family, friends, ... Also I will try to involve professional photographers,
and entities that have their own collections (botanical gardens, museums,
conservation societies of monuments such as La Alhambra de Granada or the
Topkapi palace, etc), to contribute with material from their collections.
    I do not know what success I can have, but being optimistic I must
expect a volume of contributions that I will not be able to handle by
myself, by hand. And it is for this that I request your help, perhaps
someone can make a Script-fu that automates the treatment of the photos. I
have only used Gimp sporadically to correct the color or contrast of my
photos, but I have an absolute ignorance beyond this.

    Ideally the script should run in a loop with the following actions:

    - Take a photo from the originals directory A
    - Adjust the photo to a maximum size (~ 2048 pix vertical or horizontal)
    preserving the aspect ratio
    - Add a frame around the image with the bottom side wider than the
    others (similar to Polaroid photos), and write the hastag (english and
    spanish), and the collection URL in this bottom border. This is just an
    idea, I'm open to your artistic suggestions
    - Export as .jpeg in the modified photos directory B
    - If possible, move the original photo from A directory to the C
    directory so that it is not treated again

    Maybe it is necessary to define some additional detail, please feel free
to ask me anything.

    I will exclusively dedicate a Raspberry Pi 3 for Gimp to fly.
    Every day I will try to download in the original directory "A" all the
photos received at youareonmyming scrive org (by the way, if someone knows
how to automate this, I would be soooo grateful). And also every day I will
upload all the taged photos in directory "B" to the public album (I'm still
not sure of the URL, I will probably host it in google photos).

    Any volunteer? Hope yes.

Typically done with ImageMagick: https://imagemagick.org/index.php

Some features:

https://imagemagick.org/Usage/resize/

https://imagemagick.org/Usage/text/

Probably getting a bit OT for gimp-dev, but I'll reply here anyway
this time.

For the rest, typically done with shell script(s) from bash since
all you are doing is invoking programs with some options, e.g. 'cp'
to move files from 'A' to 'C' IFF (if and only if) the modifications
to create the file in B did not end in failure.

Obviously, set aside some work space to play around with a *copy*
of a file and then when the modifications seem to work on that file,
try a copy of a different file.

I've done the resizing in the past but I've never tried adding text
on top, or borders.

But the fun part will be downloading everything from the original
directory, and then wiping out everything that is there, without
losing anything that comes in after you have started the download.

Perhaps list everything currently at the directory, wget each item
in turn checking for no errors (e.g. full disk, non-responsive
external server) make a backup (did I mention the aggravation caused
by losing something someone sent you?) and only then rm the file
from the original.

Or do the rm at the end, but perhaps keeping a separate file of those
jpegs you have successfully downloaded and adding the details to that
file after tou have successfully downloaded a file.

For IM there are lots of posts online.

I've in the past used it to resize a batch of photos, the salient
points were (from a bash script which was modifying the original
in-place):

for F in $*; do
        echo "Processing $F" # I like scripts to keep me informed

        # confirm it really is a jpeg, and find its dimensions
        DIMENSIONS=$(identify $F | grep JPEG | awk '{ print $3}')
        if [ -z "$DIMENSIONS" ]; then
                echo "ERROR: $F seems not to be a jpeg"
                exit 1
        fi
        WIDTH=$(echo $DIMENSIONS | cut -d 'x' -f1)
        DEPTH=$(echo $DIMENSIONS | cut -d 'x' -f2)

        if [ $WIDTH -gt 2048 ] || [ $DEPTH -gt 2048 ]; then
                mogrify -resize 2048x2048 $F
        else
                echo "$F not resized, is only $WIDTH x $DEPTH"
        fi
done

As with all old scripts, or hunks you find online, replace active
commands by a comment of what will happen when doing it the first
time, so in this case comment out the mogrify and add e.g.
                echo "will resize usign mogrify"
or alternatively for a simple command like that just try the command
on a copied jpeg to confirm it, and any other options you add, do
the right think (then use 'identify' and 'display' afterwards).

You might also need to consider how much upload space you have, and
bandwidth for people viewing, if this becomes popular.  I'm guessing
a jpeg of max dimension 2048 will typically be less than 2 MB, but
YMMV.

Also, you'll want to review the results at full size, even if most
people have screens which are smaller than 2048x2048.

ĸen
-- 
                 See You Later, Holy Poppadom!
                    -- Red Dwarf, The Promised Land


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]