Author Topic: a screenshot script with thumbnail, upload and bbcode, ready to paste  (Read 2768 times)


  • Techno Hippie
  • Posts: 298
  • savant (alegedly), polymath (wannabe)
    • View Profile
ok, following the release early model...   (i.e. this doesnt work yet! ~ see error output bellow)
here goes.

Code: [Select]
#! /bin/bash

#local scrot location

#this is where you're uploading your scrots

#this is where you're getting your url from

#vasties way:
#scrot -d 6 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/scrots & mirage ~/images/screenshots/$f'

#similar to way in man scrot
scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f $LOCSCROT/'

#this is the name of your picture
PIC={ls -hart $LOCSCROT | tail -n 1}

#my first notion was to reach for mogrify after a cp... but... see below...
#mogrify -resize 400x300 $LOCSCROT/$PIC

#... for my better notion...

#create a $PICTHUMB name here somehow perhaps, so i dont end up with *.png-thumb.png

#this creates the thumbnail and uploads ... no need for the thumbnail locally.
convert             \
   $LOCSCROT/$PIC        \
  -resize 400x300     \
  -background white \
  -gravity center   \
  -extent 400x300     \

#this uploads, presuming your sshfs mount is active

#this then provides you with the bb code in your clipboard
echo "[url=$UP/$PIC][img]$UP/$PIC-thumb.png[/img][/url]" | xclip

after seeing that talk about zenity n such, i thought i should get this ball rolling, hopefully light a small fire under my ass with this lil project.
the potential grows...

not just for setting locations, but methods of uploads, and so on...  well... it will come.    feel free to contribute past my sluggish ineptitude.  ^_^   there be interested parties around.  ;)

##### error
mv: cannot move ‘2013-09-25_1400x1050.png’ to ‘LOCSCROT/’: Not a directory
/home/digit/bin/zkrt: line 19: -hart: command not found
tail: 1}: invalid number of lines
convert.im6: no decode delegate for this image format `/home/digit/images/screenshots/' @ error/constitute.c/ReadImage/544.
convert.im6: no images defined `/media/ovhtoo/home/digit/stuff/scrots/-thumb.png' @ error/convert.c/ConvertImageCommand/3044.
cp: omitting directory ‘/home/digit/images/screenshots/’

XD, ok, so, somehow the scrot command didnt like my local directory variable, my ability to embed in {} is pure fantasy (or at least need quotes), somehow doesnt like to tail a single line (oh, cos zero output?), and, dear lord what have i done wrong with my imagemagick convert command!?

someone slap me. XD