Author Topic: Uk Metoffice FAX chart tif conversion script  (Read 2047 times)

0 Members and 1 Guest are viewing this topic.

Offline Supercell

  • Member
  • *
  • Posts: 35
    • Dublin Weather
Uk Metoffice FAX chart tif conversion script
« on: May 25, 2018, 12:48:02 PM »
I'm planing to add a page to my website which incorporates the freely available UK Met Office Fax Charts posted to the NOAA ftp
I'm running Weewx on a Raspberry Pi (Raspbian)and want to do this in a simple script called by cron every few hours.
So the script just gets the tifs from tgftp.nws.noaa.gov then converts them to png and uploads the resultant files to the website page.

I'm finding though that the resultant png's are larger than the original tifs and was wondering if someone has a better suggestion on how to convert to png/jpg/gif smaller than original size whilst retaining decent quality? Loooking at other sites doing this gif's seem to be popular but my experiments with gif's (converting with ffmpeg  or imagemagick)are giving much bigger files.

As an example at the moment i'm doing the following :

Code: [Select]
convert PPVA89.TIF -depth 2 -type bilevel -rotate 270 -resize 1076 -quality 100 PNG8:PPVA89.png
This gives me a png of around 110kb compared to the original 66kb which while ok I feel could be much better for a black and white image.
Grateful for any advice!
 

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7549
    • Eagle Bay Weather
Re: Uk Metoffice FAX chart tif conversion script
« Reply #1 on: May 25, 2018, 01:49:38 PM »
Dump the alpha channel (-alpha) and extra stuff with -strip
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline Supercell

  • Member
  • *
  • Posts: 35
    • Dublin Weather
Re: Uk Metoffice FAX chart tif conversion script
« Reply #2 on: May 26, 2018, 04:06:39 AM »
Thanks Bushman , that knocked off 10kb, every little helps!

Offline Supercell

  • Member
  • *
  • Posts: 35
    • Dublin Weather
Re: Uk Metoffice FAX chart tif conversion script
« Reply #3 on: May 31, 2018, 03:55:19 PM »
Managed to get it down to around 65kb processing using pngquant after imagemagick with good quality so pleased with that.

A lot of work later the page is up - http://www.loughlinstown.com/bracknell.html
The scripts should update these charts shortly after uploaded to the NOAA ftp , or at least that's the theory :)
Some tweaking to the script timings no doubt needed, will keep an eye on those over the next few days and adjust accordingly.

 

anything