cloudy

Author Topic: Post Processing GRLevel3 Images...  (Read 21208 times)

0 Members and 2 Guests are viewing this topic.

Offline MesquiteWx

  • Nick
  • Posts: 403
  • Mesquite Weather Network
  • Mesquite, Texas
    • Mesquite Weather Network
Re: Post Processing GRLevel3 Images...
« Reply #75 on: August 13, 2008, 01:19:10 AM »
Thanks for the reply. One thing that is throwing me is GR3 produces the images like this, kfws_br1_0.jpg, kfws_br1_1.jpg, kfws_br1_2.jpg, and so on all the way up to 9. So do I need to make a command for each one of those images and have it renumber them on the output side? How does it know where the images are at and where to send the new ones? Sorry for the questions, it might make more sense once they open my SSH access. I am still waiting for them to enable it for me.

Also it looks like you are using the same animation software as me, I am just using the newest version from what I can tell. I don't know if the older version had this, but the new one allows you to embed music so I have my weather stream linked to my radar as well. You can adjust he volume by sliding the speaker from left to right...

http://www.mesquitechristmas.com/weather/wxgr3radar.php

Online TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Global Moderator
  • Posts: 5,865
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: Post Processing GRLevel3 Images...
« Reply #76 on: August 13, 2008, 01:38:19 AM »
The version I purchased has sound capabilities, but I am not a big fan of sound on a website without the visitor knowing in advance that it is going to happen. 

I am simply using the following setting for GRLevel3 which sends the same filename each time.  I don't let it use counters as I have a process that looks for the new images and moves them to where I create a history of them with timestamps.

This way I can sort, count whatever the images as I see fit.

The filenames that are saved depend on what you have selected in GRLevel3... 

In the attached, you can see I have 4 settings setup, so I get 4 files

kiwa_cr.jpg
kiwa_br1.jpg
kiwa_et.jpg
kiwa_vil.jpg


All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline MesquiteWx

  • Nick
  • Posts: 403
  • Mesquite Weather Network
  • Mesquite, Texas
    • Mesquite Weather Network
Re: Post Processing GRLevel3 Images...
« Reply #77 on: August 13, 2008, 01:53:25 AM »
I don't know if I like the weather feed starting when you first come to the page ether, I agree with you on that. I will probably have it off and allow the user to turn it on once I get this radar sorted.

I know how to turn the sequence on and off, but I don't have any script that will cache a certain number of images so I am not sure how to create a loop otherwise. This is starting to make more sense though, thank you for your help. Do you know where I can find a script that will cache a history so I can make a loop from just one image like you have done?

-Thanks

Online TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Global Moderator
  • Posts: 5,865
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: Post Processing GRLevel3 Images...
« Reply #78 on: August 13, 2008, 02:18:34 AM »
The one I created is a simple ksh script called via a crontab entry.   The source used by the page is a PHP script...

Both are a bit on the gross side.  I am about to redo that stuff as I move my sites over to a new web server that I have been building and testing the past week.

They ksh script is:

Code: [Select]
#!/usr/bin/ksh
############################################################################
# A Project of TNET Services, Inc.
############################################################################
#
#   Project:    TNET Weather Station Pages
#   Module:     grlevel_move.ksh
#   Purpose:    Main Index Page for TNETWeather
#   Authors:    Kevin W. Reed <kreed@tnet.com>
#               TNET Services, Inc.
#   Dist:       INTERNAL
#
#   Copyright: (c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
#   This document uses Tab 4 Settings
############################################################################
STORE='...homedir.../'
DT=`/usr/bin/date '+%Y%m%d%H%M'`
GETFILE='kiwa_br1.jpg'
#################################################
if [ ! -e ${GETFILE} ]] ; then exit ; fi
mv ${GETFILE} br1.jpg
sleep 10
# Process Image
/usr/local/bin/convert br1.jpg -crop 590x590+50+0 br1a.jpg
/usr/local/bin/convert br1a.jpg grlevel3-bot.gif -append br1b.jpg
/usr/local/bin/composite -gravity NorthWest tws-grlevel3-topbox.gif br1b.jpg br1c.jpg
/usr/local/bin/convert br1c.jpg -resize 200x210! gr1_0-currentsm.jpg
/usr/local/bin/composite -gravity SouthWest tws-grlevel3-logo.gif br1c.jpg br1d.jpg
#################################################
mv br1d.jpg gr1_0-current.jpg
cutfiles
cp gr1_0-current.jpg ${STORE}/${DT}image.jpg
#################################################
# Remove tmp files
rm br1a.jpg br1b.jpg br1c.jpg br1d.jpg br1.jpg
#################################################


the PHP script has stuff in it I can't release right at the moment though...

BTW, you can include the SWF slide show without using EMBED...

I sent this to the autor, but apparently he hasn't updated his examples with it...

<object type="application/x-shockwave-flash"
    data="slideshow.swf?php_source=slshow.php&amp;license=yourlicense"
    width="590" height="646"  >
    <param name="movie" value="slideshow.swf?php_source=slshow.php&amp;license=yourlicense" />
    <param name="quality" value="high" /> 
    <param name="bgcolor" value="#000000" />
    <param name="wmode" value="transparent" />
</object>


All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline MesquiteWx

  • Nick
  • Posts: 403
  • Mesquite Weather Network
  • Mesquite, Texas
    • Mesquite Weather Network
Re: Post Processing GRLevel3 Images...
« Reply #79 on: December 17, 2011, 01:03:44 AM »
I know this is a old thread but this was something I was working before I had my accident and my site went offline and I would like to revisit this. I have been reading for hours about ImageMagick and I have no clue where to start. All I know is it is on my server at /usr/bin/. Is this like a program you run, a script you create or what? How exactly do you access ImageMagick?

-Thanks

Online TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Global Moderator
  • Posts: 5,865
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: Post Processing GRLevel3 Images...
« Reply #80 on: December 17, 2011, 04:06:01 AM »
Been three years+ ...  I still use this however.

This is being done via a Perl Script on one of my Unix servers.  It is controlled by cron and runs once every minute....

* * * * * /Path_to_VirtualHosts/weather/grlevel3/update.pl >>  /Path_to_VirtualHosts/weather/grlevel3/update.log 2>&1

the commands in the Perl script are something like:

command( "/usr/local/bin/convert " . $filename . " -crop 590x590+50+0 tmp.jpg" );
command( "/usr/local/bin/composite -gravity NorthWest tws-grlevel3-topbox.gif tmp.jpg tmp1.jpg" );
command( "/usr/local/bin/convert tmp1.jpg -resize 200x210! " . $basename . "_currentsm.jpg" );
command( "/usr/local/bin/convert tmp1.jpg tws-grlevel3-bot.gif -append tmp.jpg" );
command( "/usr/local/bin/composite -gravity SouthWest tws-grlevel3-logon.gif tmp1.jpg tmp.jpg") ;


Which is basically...

o Converts original file that is uploaded and crop it removing the black index from the left side.
o Composite that resulting file by adding top section
o Re-size a version smaller for the mobile site
o Append the bottom section to the image (non-mobile)
o Composite that and add TNET Weather logo to the image (non-mobile)

The log just tells me how it is doing... and the script only does something, if a new image was updated.  Otherwise it just exits.

command is a function that I wrote that does the system call after checking for a number of things first.

« Last Edit: December 17, 2011, 04:08:00 AM by TNETWeather »

All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline MesquiteWx

  • Nick
  • Posts: 403
  • Mesquite Weather Network
  • Mesquite, Texas
    • Mesquite Weather Network
Re: Post Processing GRLevel3 Images...
« Reply #81 on: December 17, 2011, 04:38:05 AM »
Forgive me this is all new to me when it comes to Perl, SSH. Crons I am really familiar with. What I am lost is those commands, do they just go into a file like you have them in your example? If so where do you put it, cgi-bin? Then where does it output the files so you can call them in your site? Where I am lost is where and how do you use these commands. Where is the /usr/local/bin/convert and how do I access it?

-Thanks

Online TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Global Moderator
  • Posts: 5,865
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: Post Processing GRLevel3 Images...
« Reply #82 on: December 17, 2011, 04:45:09 AM »
Forgive me this is all new to me when it comes to Perl, SSH. Crons I am really familiar with. What I am lost is those commands, do they just go into a file like you have them in your example? If so where do you put it, cgi-bin? Then where does it output the files so you can call them in your site? Where I am lost is where and how do you use these commands. Where is the /usr/local/bin/convert and how do I access it?

-Thanks

ImageMagik is a set of binaries that do things.

All of what I am doing is that the shell level, not the web level.  So cgi-bin is not involved.  I'm not calling this from a web page, it is being called by cron using shell commands.  Not all hosting has that ability.

For example, in the post above, I am access the ImageMagik command called convert which I have locate on my server in /usr/local/bin

So the command:

Code: [Select]
/usr/local/bin/convert $filename -crop 590x590+50+0 tmp.jpg
takes the file that is specified in $filename and uses convert to crop it to 590x590+50+0 and save the result in tmp.jpg

« Last Edit: December 17, 2011, 04:47:33 AM by TNETWeather »

All you need is Time, Aptitude and Desire ... and you can build just about anything...

 

cumulus