Sponsored Content
Full Discussion: print metadata to jpg
Top Forums Shell Programming and Scripting print metadata to jpg Post 302485407 by flash80 on Wednesday 5th of January 2011 06:43:25 AM
Old 01-05-2011
thx again Chuble_XL it is working very well the black frame is perfect.

The script is working for a specific jpg. I would like it work for any jpg, using the following form.

GPStoPic file1.jpg # for a chosen file
or
GPStoPic for * # for all the files in a specific directory.

Once the program executed it should output append "GPS" in the name of the file.

ex: GPStoPic file1.jpg will output file1GPS.jpg

Actual scipt

Code:
source=source.jpg
target=target.JPG
 
# get the image's size, width=$1, length=$2, you need adjust for your image,
# depand the output format of command identify
set -- $(identify $source |awk 'NR==1{split($3,a,"x"); print a[1],a[2]}')  
I_WIDTH=$1
I_LENGTH=$2
 
function maxwidth()
{
        MAX_WIDTH=0
        while read line
        do
                INFO=$(convert -size 1025x768 xc:lightblue -font times.ttf -pointsize 18 -fill none -undercolor white -annotate +20+100 "$line" -trim info:)
                WIDTH=${INFO##*XC }
                WIDTH=${WIDTH%%x*}
        [ $WIDTH -gt $MAX_WIDTH ] && MAX_WIDTH=$WIDTH
        done
        echo $MAX_WIDTH
}
 
MW=$(jhead $source| grep "GPS " | maxwidth)
let WIDTH=MW+10
HEIGHT=60
 
convert -size ${WIDTH}x${HEIGHT} xc:black plaque.jpg
composite plaque.jpg -geometry +5+$(( $I_LENGTH - $HEIGHT - 5 )) -dissolve 60 $source $target
 
CMD=$(jhead $source |grep "GPS " |awk -v width=$1 -v lngth=$2 -v tfile=$target '
NR==1{Latitude=$0}NR==2{Longitude=$0} NR==3{Altitude=$0}
END{
    printf "convert -pointsize 18 -font times.ttf -fill white "
    printf "-draw \"text 10,%d %c%s%c\" ", lngth-46, 39, Latitude, 39
    printf "-draw \"text 10,%d %c%s%c\" ", lngth-28, 39, Longitude, 39
    printf "-draw \"text 10,%d %c%s%c\" ", lngth-10, 39, Altitude, 39
    printf "%s %s\n", tfile, tfile }')
eval $CMD
#END



Can anybody help
thx again Chuble_XL

Last edited by flash80; 01-05-2011 at 07:44 AM.. Reason: forget to past code
 

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Print the content of a directory in jpg file

Is there any possible way to print the contents of a directory to a .jpg file? I have a list of thumbnails (e-books) which I want to share (+500) but I don't know how to make this. I would appreciate a lot any comments regarding this issue. (4 Replies)
Discussion started by: agasamapetilon
4 Replies

2. Programming

Best way to dump metadata to file: when and by who?

Hi, my application (actually library) indexes a file of many GB producing tables (arrays of offset and length of the data indexed) for later reuse. The tables produced are pretty big too, so big that I ran out of memory in my process (3GB limit), when indexing more than 8GB of file or so.... (9 Replies)
Discussion started by: emitrax
9 Replies

3. Shell Programming and Scripting

Rename all ".JPG" files to ".jpg" under all subfolders...

Hi, Dear all: One question ! ^_^ I'm using bash under Ubuntu 9.10. My question is not to rename all ".JPG" files to ".jpg" in a single folder, but to rename all ".JPG" files to ".jpg" in all subfolders. To rename all ".JPG" to ".jpg" in a single folder, for x in *.JPG; do mv "$x"... (7 Replies)
Discussion started by: jiapei100
7 Replies

4. UNIX for Advanced & Expert Users

LVM - restore metadata on other disk

Hi guys, I would like to ask your opinion about my theory, how to fix my broken LVM without risking any data loss. I use Archlinux at home. I just love this distro, even it gives me a lots of work (particularly after system updates). Basic system spec: AMD FX(tm)-6100 Six-Core Processor... (1 Reply)
Discussion started by: lyynxxx
1 Replies

5. UNIX and Linux Applications

About gvfsd-metadata

I need a hint about gvfsd-metadata using mate on bsd. Or dual-core cpu, quad-core cpu ore an old laptop single core, the gvfsd is an obstacle and does not accelerate anything, vice versa, it slows down many processes, coming from gnome. So someone can give me a hint how to wipe it out for good? I... (1 Reply)
Discussion started by: 1in10
1 Replies
RABBIT(1)							      rabbit								 RABBIT(1)

NAME
rabbit - presentation tool using RD, simple text format SYNOPSIS
rabbit [options] [SOURCE_INFOS] DESCRIPTION
Theme -I, --include=PATH Add [PATH] to load path. -t, --theme=THEME Use [THEME] as theme. (default) --comment-theme=THEME Use [THEME] for comment. () --allotted-time=TIME Use [TIME] as allotted time. () Source -T, --type=TYPE Specify source type as [TYPE]. Select from [auto, argf, file, memory, slideshare, uri]. Note: case insensitive. (auto) When select ARGF specify none (get from STDIN) or [FILE_NAMES] as [SOURCE_INFOS]. When select File specify [FILENAME] as [SOURCE_INFOS]. When select Memory specify [FILENAME_OR_NOT] as [SOURCE_INFOS]. When select SlideShare specify [USER] and [TITLE] as [SOURCE_INFOS]. When select URI specify URI as [SOURCE_INFOS]. -e, --encoding=ENCODING Specify source encoding as [ENCODING]. (auto) -B, --base=BASE Specify base URI or path of source as [BASE]. (auto) Initial state -f, --[no-]full-screen Toggle full screen mode. (off) --[no-]index-mode Toggle index mode. (off) Size -g, --geometry=GEOMETRY Set window geometry [GEOMETRY]. Format: WIDTHxHEIGHT+X+Y (nil) -w, --width=WIDTH Set window width to [WIDTH]. (800) -h, --height=HEIGHT Set window height to [HEIGHT]. (600) -S, --size=WIDTH,HEIGHT Set window width and height to [WIDTH] and [HEIGHT]. (800,600) Save -s, --save-as-image Save as image and exit. -i, --saved-image-type=TYPE Specify saved image type as [TYPE]. (png) -bBASE_NAME, Specify saved image base name as [BASE_NAME]. --saved-image-base-name (Title of slide) --saved-image-basename --[no-]output-html Output HTML for viewing saved images. (false) --[no-]output-index-html Output index HTML for navigating slides. (false) --rss-base-uri=URI Specify base URI of RSS as [URI]. RSS is generated only when HTML is output. () --source-filename=FILENAME Specify source filenam as [FILENAME]. () Print -p, --print Print and exit. -o, --output-filename=FILENAME Specify printed out filename as [FILENAME]. (#{Title of slide}.pdf) --slides-per-page=SLIDES Set slides per page. (1) --[no-]draw-scaled-image Draw scaled image. Better look for displaying but lesser look for printing. (true) Paper --paper-width=WIDTH Set paper width to [WIDTH] Pt. (landscape A4 width) --paper-height=HEIGHT Set paper height to [HEIGHT] Pt. (landscape A4 height) --paper-size=WIDTH,HEIGHT Set paper width and height to [WIDTH] Pt and [HEIGHT] Pt. (landscape A4 size) Margin --margin-left=MARGIN Set left margin for slides per page mode print. (auto) --margin-right=MARGIN Set right margin for slides per page mode print. (auto) --margin-top=MARGIN Set top margin for slides per page mode print. (auto) --margin-bottom=MARGIN Set bottom margin for slides per page mode print. (auto) --margin={ [ALL] | [TOP_BOTTOM],[LEFT_RIGHT] | [TOP],[LEFT_RIGHT],[BOTTOM] | [TOP],[RIGHT],[BOTTOM],[LEFT]} Set margin for slides per page mode print. --page-margin-left=MARGIN Set left page margin. (auto) --page-margin-right=MARGIN Set right page margin. (auto) --page-margin-top=MARGIN Set top page margin. (auto) --page-margin-bottom=MARGIN Set bottom page margin. (auto) --page-margin={[ALL]|[TOP_BOTTOM],[LEFT_RIGHT]|[TOP],[LEFT_RIGHT],[BOTTOM]|[TOP],[RIGHT],[BOTTOM],[LEFT]} Set page margin. dRuby --[no-]use-druby Specify whether to use dRuby. (true) --druby-uri=URI Specify dRuby URI. (druby://127.0.0.1:10101) --[no-]output-druby-uri Specify whether to output dRuby URI. (false) SOAP --[no-]use-soap Specify whether to use SOAP. (false) --soap-host=HOST Specify SOAP host as [HOST]. (0.0.0.0) --soap-port=PORT Specify SOAP port as [PORT]. (10103) XML-RPC --[no-]use-xmlrpc Specify whether to use XML-RPC. (false) --xmlrpc-host=HOST Specify XML-RPC host as [HOST]. (0.0.0.0) --xmlrpc-port=PORT Specify XML-RPC port as [PORT]. (10104) Server --[no-]server Specify whether to run as server. (false) Public level --public-level=LEVEL Specify public level. Select from the following: [ strict, move, read-size, change-size, size, read-source, change-source, source, control, all ] (all) Comment --comment-source=FILE Deprecated. Just ignored. Specify initial comment source. (default source) --comment-encoding=ENCODING Deprecated. Just ignored. Specify comment source encoding. (auto) Migemo --migemo-dictionary-search-path=PATH1,PATH2,... Specify search paths for Migemo static dictionary. (/usr/share, /usr/local/share) --migemo-dictionary-name=NAME Specify static dictionary name for Migemo. (migemo-dict) 3D --[no-]use-gl Specify whether to use OpenGL if available. (false) Display --[no-]keep-above Specify whether to keep above window. (false) Others --[no-]show-native-window-id Show a native window ID of the Rabbit window if available. e.g. The ID is the ID of X resource on X window system. (false) Common options --locale-dir=DIR Specify locale dir as [DIR]. (auto) --logger-type=TYPE Specify logger type as [TYPE]. Select from [stderr, gui]. (STDERR) --log-level=LEVEL Specify log level as [LEVEL]. Select from [debug, info, warning, error, fatal, unknown]. (info) --help Show this message. --version Show version. rabbit 1.0.7 June 2012 RABBIT(1)
All times are GMT -4. The time now is 04:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy