Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-01-2011, 06:00   #1
Registered User
 
bewitched's Avatar

Join Date: Sep 2009
Posts: 885
Images: 3
jpg in OpenCPN

I'm really struggling to convert jpg files to a format I can use in Open CPN. Hope someone can help - not much is going right at the moment.

The files I want to convert are found here:
Office of Coast Survey's Historical Map & Chart Project Image Catalog
(search region Philippine Islands)

I'm trying to follow the instructions here:
Conversion Using Linux | Official OpenCPN Homepage

They don't seem to be working for me (to be honest I don't understand much of what they say - there seems to be an assumption that the reader has software development or programming knowledge - which I don't).

1st issue: Can't figure out how to use imagemagick. Doesn't seem to have an .exe file or any obvious (to me) way to install. Tried running from from the command prompt (something I only found out about the other day - and don't really understand). All I get there is "Invalid Parameter - -colors"

I did download another converter software and manage to get .tif and .png files from the .jpg (although they are between 200,000KB and 400,000KB each)

2nd issue is with Mapcal. I can't open the .png files I have created. Mapcal goes straight to "not responding' as soon as I try to open them. Is this a file size thing? I've been successful if I crop down to just a little corner of the jpg & convert it.

I did manage to generate a CHARTCAL.DIR file successfully with a small corner of the chart, but failed to get a .hdr file or a .kap.


I guess what I'm asking for are very simple step by step instructions that someone who is not familiar with software development or programming can follow.

Do such instructions exist?
__________________

__________________
bewitched is offline   Reply With Quote
Old 04-01-2011, 08:02   #2
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
hello.

First and most important step is to reduce the number of colours from the RGB JPEG map you download to a Palette PNG/TIFF. Do it with Imagemagic or XnView or Gimp. You can also use other image tools that have this ability.

I used XnView to convert the image to 64 colours palette without problems. Note: you need a lot of RAM for such big images, at least 2GB RAM to not wait minutes each mouse click... Anyway the conversion takes a lot, at least in gimp.

After that, save in PNG (file should be now 30MB/40MB in size) and in TIFF.

The rest of the process should go as described in the OCPN documentation.

Ciao, Marco
__________________

__________________
GPS-Marco is offline   Reply With Quote
Old 04-01-2011, 08:11   #3
Registered User

Join Date: Jun 2010
Location: St. Petersburg, Florida
Boat: Gemini 3200
Posts: 702
Quote:
Originally Posted by bewitched View Post
1st issue: Can't figure out how to use imagemagick. Doesn't seem to have an .exe file or any obvious (to me) way to install.
This makes me think you're running Windows. If that's the case the Linux instructions don't apply. Have you downloaded LibBSB? Under Windows you can load a .jpg file into Paint and save it as a .tif file. LibBSB has utilities for converting between .tif and BSB files. Maybe that will help you some.

How do you plan to use those charts? I'm just curious.

Fabbian
__________________
fgd3 is offline   Reply With Quote
Old 04-01-2011, 16:18   #4
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Quote:
Originally Posted by bewitched View Post
I'm really struggling to convert jpg files to a format I can use in Open CPN. Hope someone can help - not much is going right at the moment.

The files I want to convert are found here:
Office of Coast Survey's Historical Map & Chart Project Image Catalog
(search region Philippine Islands)

I'm trying to follow the instructions here:
Conversion Using Linux | Official OpenCPN Homepage

They don't seem to be working for me (to be honest I don't understand much of what they say - there seems to be an assumption that the reader has software development or programming knowledge - which I don't).

1st issue: Can't figure out how to use imagemagick. Doesn't seem to have an .exe file or any obvious (to me) way to install. Tried running from from the command prompt (something I only found out about the other day - and don't really understand). All I get there is "Invalid Parameter - -colors"

I did download another converter software and manage to get .tif and .png files from the .jpg (although they are between 200,000KB and 400,000KB each)

2nd issue is with Mapcal. I can't open the .png files I have created. Mapcal goes straight to "not responding' as soon as I try to open them. Is this a file size thing? I've been successful if I crop down to just a little corner of the jpg & convert it.

I did manage to generate a CHARTCAL.DIR file successfully with a small corner of the chart, but failed to get a .hdr file or a .kap.


I guess what I'm asking for are very simple step by step instructions that someone who is not familiar with software development or programming can follow.

Do such instructions exist?
Well,I'll try if you don't mind the blind leading..
FOR XP
Be aware that trying to open a chart image in some Pictureview programs is like watching paint dry.A large image can easily overcome your ram and choke your page file too, I guess.Therefore.Start with a happy,fast computer,freshly rebooted,and with as much of the stuff down at the clockTURNED OFF as you can live with.That said,I can open 350mb chartbmps on a PIII so what ARE you doing wrong,eh?

Charting programs are excellent at opening huge images.Go figure.

Anyways,get your image.Get a MERCATOR one or a rectangular piece of ANY map say where the planet seems flat eh?2000x2000 pixels is fine but less is better for now?say 1024x720?Oh,I dunno... .Fuss later.Rectangular IS probably best.To start,why not use the "PrintScreen"button on your computer if you know about it? You CAN use much bigger images but now,just get something that's seeable.

If it's not already a ".bmp",you need Convert it. (I like Irfanview...there's a portable version It won't take over ALL your pictures unless you tell it to in options I love Faststone too but NOT for this work)


Whatever program you use,Find out the image's colour depth.It's there somewhere in almost every program..."Info"Properties"somewhere.Irfanview shows it on the bottom border.Look for a way to downgrade The colour depth.This is also called bit depth.In irfan it's "Image,Reduce Colour Depth"

256 colours is 8 bitsperpixel. 16 colours is 4 bitsperpixel.
Really,in a chart,16 colours is fine and it simplifies here and now.
But 256 is fine and more common.Google Earth grabs look better.



Now "save as" dialogue.and choose "bmp".AND choose a shortnospace name.THEN,save it again with the same name but this time "save as"tif" (or"tiff")It's best to save a tif without compression until you or I know better!
Reopen the picture to make sure I haven't forgot to mention something!Ok?

by the way,I should have said,While you are looking at the picture,note it's projection,DepthUnits,and scale IF AVAILABLE but if not, carry on.


MapCal ..."File,Open Image"
Browse to your bmp.The first thing ,Now,the pop-upwindow is called "Chart Information" shows up to fill in the name of your Project.You have to name it.Choose a SHORT one.There are places for other info you might have handy but blanks are ok EXCEPT the Datum and Projection.
Datum is your choice. I go for WGS84,as it's the general usage.Don't fill any corrections in to start.Projection,well,I know seaclear works for several but just now,MERCATOR Any Charting program should be happy with it.

click ok.You can return to that dialogue anytime with "Edit,Chart Info"

Now clickndrag the image to a place you know the position.On a chart picture this is really easy given the crossings of lat/long lines.Place the cross over this spot.Without moving it,rightclick and choose "Addnew..."You cannot evermove it again.But you can delete it by placing the cursor over it and rightclick"delete.Now,fill in it's lat and long under "Point One" Format can be Degree,Minutes remainder as decimal minutes. and don't forget N or S Likewise Longitude.E or W .LOOKS LIKE:

05007.9895 N
12452.0850 W


In my example this is tremendously easy because I have these lines crossing:50 08 and 124 52
MY numbers do not agree,you'll note....but that's the datum thing.I know they drew the map on 1927Datum.No satellites then.Just Windup clocks.It's not suprising longitude is out a bit.It's astounding how good charts CAN be.(Hail Parizeau and Assistants!)These corrections I deduce from the chart's printed info to .63"/60 North and 5.1"/60 East-well,actually I'm guessing here to illustrate but you can do better.Just remember that they DREW these charts so don't get too worked-up yet.


To choose and find the positions of your calibration points without it being so easy,you can easily have another chart program going or even be online with with a mapserver in another window.MapCal doesn't need much resources.Find mountain tops and rocks and so on that agree with your picture.(By the way,I think Google Earth maps are "Lat/Long".This means the long scale=latitude scale!So they will not fit exactly over a mercator)

Place the next point Diagonally to the first.

When you have 2 points,Put a grid on .Choose "Normal" then "Activate Changes"
If the grid suits,you are nearly done.Put a third calibration point in,a fourth,a fifth if you want.Keep an eye on the grid.It's your best insurance against screwing up.
Really,two will work More can help or hinder depending.Fuss later.


NOW go to File,SaveCalibration.A message pops up.You now have a CHARTCAL.DIR(somewhere!oh yes-in the same directory as your image.)
Go and look at it.Open it with notepad.Savour it.Rename it is what I would do....say,"1CHARTCAL.DIR".Otherwise,If you do another calibration,it'll end up in there too.For now,that complicates.Rename it Please.

Now you're nearly done.CONCENTRATE.This is the worst part,maybe.

In WindowsXP -sorry,I'm old-

Goto "Start",choose "Run".Type"cmd" no quotes of course then "Ok"
In XP,the default for cmd prompt starts in "Documents and Settings\Administrator"For now,make copies of mc2bsbh and tiff2bsb and put em in that folder.It's easier.But you could use CD as your first command and tell the command prompt where to go.....just avoid having to repeat longstringsoftextthatallowerrorswhereyoudon'thavet o.
OK?

At the blinking cursor in that black window,type:
"mc2bsbh" no quotes.I won't say"no quotes" again.

...and hit "Enter"on your keyboard.I will hereafter say "<Enter>" for this.


You should now see this in XP:

"Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>mc2bsbh

mc2bsbh (beta09): converts georeference format from MapCal to BSB header

Usage: mc2bsbh [-d] [-s chartname] [-o outfile | -e extension] [-l] <infile>

<infile> : the output from MapCal - normally CHARTCAL.DIR
-d : this is debug mode. It prints out a bunch of garbage
-s chartname : convert a single chart header from <infile>
-o outfile : to specify your own header file name
-e extention : to specify your own header extension
-l : to print out just the list of charts in <infile>

C:\Documents and Settings\Administrator>"

...a few notes:I did tell you to use shortnames and avoid spaces because it's simpler and less tedious.

"<space> means a space.

Now do this:

mc2bsbh<space>1chartcal.dir .... hit "<Enter>"key.
TADA!Hope it worked.You should see "YourMapcalChartname.hdr"appear in the same folder.

Now type this: "tif2bsb<space>YourMapcalChartname.hdr<space>yourm ap16colourstiff.tif<space>thenameofyourNewChart.ka p "<Enter>

I did tell you to make a tif.


Now-you got an error?Did you make a 256 colour tiff?It's Ok.

Redo the command as this:
tif2bsb<space>-c<space>127<space>yourMapcalchartname.hdr<space>yo ur256colourtiffile.tif<space>yourbrandnewkapsname. kap"<Enter>

you don't need to use capitals even if they exist in the name.That said,you can put Capitals in the output and they'll show.In any case,you can change the name of the kap to whatever you want now it's made.Run off and test it in your chart program.
__________________
HappySeagull is offline   Reply With Quote
Old 04-01-2011, 17:44   #5
Registered User
 
bewitched's Avatar

Join Date: Sep 2009
Posts: 885
Images: 3
Quote:
Originally Posted by GPS-Marco View Post
hello.

First and most important step is to reduce the number of colours from the RGB JPEG map you download to a Palette PNG/TIFF. Do it with Imagemagic or XnView or Gimp. You can also use other image tools that have this ability.

I used XnView to convert the image to 64 colours palette without problems. Note: you need a lot of RAM for such big images, at least 2GB RAM to not wait minutes each mouse click... Anyway the conversion takes a lot, at least in gimp.

After that, save in PNG (file should be now 30MB/40MB in size) and in TIFF.

The rest of the process should go as described in the OCPN documentation.

Ciao, Marco

Thanks -

Yes, I think the size of the files is my first hurdle. If reducing the colours palette reduces the size so much then that would make sense - especially since the files I'm trying to convert are largely black and white anyway. I'll try it.

I don't think that my computer's RAM is the problem, I've much more than 2mb and it doesn't seem to have any problems opening the 400,00KB files in other programmes (just Mapcal!!)
__________________
bewitched is offline   Reply With Quote
Old 04-01-2011, 17:52   #6
Registered User
 
bewitched's Avatar

Join Date: Sep 2009
Posts: 885
Images: 3
Quote:
Originally Posted by fgd3 View Post
This makes me think you're running Windows. If that's the case the Linux instructions don't apply. Have you downloaded LibBSB? Under Windows you can load a .jpg file into Paint and save it as a .tif file. LibBSB has utilities for converting between .tif and BSB files. Maybe that will help you some.

How do you plan to use those charts? I'm just curious.

Fabbian
Thanks

I thought I might be following the wrong instructions (to be honest - I don't even know what Linux is..)

The charts, I intend to use for.... don't laugh....for navigation when I'm in the Philippines later this year.

I've previously found that C-map (which is on my chart plotter and running through the Maxsea on my laptop) is pretty useless for the Philippines. No where near enough detail for the tight spots.

Previously, I've used paper versions of these (historical) charts as my primary means of navigation. I thought having them in electronic form may make life a bit easier.
__________________
bewitched is offline   Reply With Quote
Old 04-01-2011, 17:54   #7
Registered User
 
bewitched's Avatar

Join Date: Sep 2009
Posts: 885
Images: 3
HappySeagull

That is just amazing

Thanks so much for the effort
__________________
bewitched is offline   Reply With Quote
Old 04-01-2011, 19:38   #8
Obsfucator, Second Class
 
dacust's Avatar

Cruisers Forum Supporter

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,743
Quote:
Originally Posted by HappySeagull View Post
Well,I'll try if you don't mind the blind leading..
FOR XP
You know, for a blind guy, you did an excellent job of explaining that. Well done!

For bewitched, the only thing I'd add off the top of my head, is that, depending on what software you use to create the .tif, and quite possibly what the format of the original image was, you might end up with a RGB type tif which will not work with tif2bsb (it requires a palette type tif). If this is the case, tif2bsb will give you and error. If that happens to you, just copy that message and post it in here. If it is the palette/RGB issue, there are tricks to convert it to palette.

Could be your graphics software can easily convert from RGB to palette. If not, imagemagick can do it in a 2 step process.

-dan
dacust is offline   Reply With Quote
Old 05-01-2011, 02:13   #9
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
Quote:
Originally Posted by bewitched View Post
Thanks -

Yes, I think the size of the files is my first hurdle. If reducing the colours palette reduces the size so much then that would make sense - especially since the files I'm trying to convert are largely black and white anyway. I'll try it.

I don't think that my computer's RAM is the problem, I've much more than 2mb and it doesn't seem to have any problems opening the 400,00KB files in other programmes (just Mapcal!!)
Hello. Converting colours RGB to Palette (max 127 colours) is not only for size reduction: it is a prerequisite to make a kap chart. RGB images will not work.

Ciao, Marco.
__________________
GPS-Marco is offline   Reply With Quote
Old 05-01-2011, 02:16   #10
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
Hello Happyseagull: could you put your chart creation process in the OCPN site. There is a linux process there (Conversion Using Linux | Official OpenCPN Homepage) but not a windows one.

Ciao, Marco.
__________________
GPS-Marco is offline   Reply With Quote
Old 05-01-2011, 05:40   #11
Registered User
 
bewitched's Avatar

Join Date: Sep 2009
Posts: 885
Images: 3
I got it to work!!!!

Boy oh Boy am I a happy bunny
__________________
bewitched is offline   Reply With Quote
Old 05-01-2011, 11:07   #12
Obsfucator, Second Class
 
dacust's Avatar

Cruisers Forum Supporter

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,743
Quote:
Originally Posted by bewitched View Post
I got it to work!!!!

Boy oh Boy am I a happy bunny
WOOHOO!!!
dacust is offline   Reply With Quote
Old 05-01-2011, 11:39   #13
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Quote:
Originally Posted by bewitched View Post
I got it to work!!!!

Boy oh Boy am I a happy bunny
Hey,I'm really pleased it helped!I actually made a kap from scratch while I was doing it.Are you using 16 colours or 256?I just came up with that on the fly but the charts made open fine in OpenCPN ,whether 16 or 256.
But I should have said make a png as well...Seems it will be handy.

I'm still not sure myself if I should start with a png or bmp in MapCal_2 (because MapCal exportsfrom WCI as bmps! so isn't that the native format in the Windows version?sigh...)but I'm pretty excited about KapGen (on another thread!)if I can grade out the bumps in my comprehension...
Ideally,this could be like going up the mast with ALL the tools...
__________________
HappySeagull is offline   Reply With Quote
Old 05-01-2011, 15:59   #14
Senior Cruiser
 
sinbad7's Avatar

Cruisers Forum Supporter

Join Date: Sep 2003
Location: Ubatuba,SP,Brazil (Ex Norway)
Boat: (Ex) Alu. 60' yacht-"Eight Bells"
Posts: 2,717
Images: 57
Send a message via Skype™ to sinbad7
HappySeagull..

Seemed a lota lota to calibrate a .kap.

1.Use 'jpegopt' or similar to compress the .jpg file. (if it is a .jpg)
2.Use 'gimp2' to reduce the number of colours to 126 and save as a .png
3.Use MapCalII to make the CHARTCAL calibration file,selecting 4 or more geo locs with the help of your C-Map charts and similar land marks or grids.
Alternatively,if the map coordinates of the corners are shown on the map,use those. Finally,select the automatically generated corner coordinates and save file.
4. Use 'Chartconvert',feeding it with your chart.png and CHARTCAL files to produce the .kap chart. THAT'S ALL!!

Tore
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 05-01-2011, 20:40   #15
Registered User
 
bewitched's Avatar

Join Date: Sep 2009
Posts: 885
Images: 3
Quote:
Originally Posted by sinbad7 View Post
Use 'Chartconvert'
Tore

Always looking to streamline the process.... especially if I don't have to use that horrible Command Prompt thingy.

What's "Chartconvert". I googled, but without much luck. Do you have a link?

ta.
__________________

__________________
bewitched is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NMEA 2K and OpenCPN - How? sapster77 OpenCPN 18 13-03-2013 12:29
OpenCPN 2.3.0 dlymn OpenCPN 3 29-06-2011 02:44
OpenCPN bdbcat OpenCPN 1343 19-09-2009 16:59
Converting .JPG/.JPW arial photos to BSB format dacust Navigation 0 17-02-2008 14:20



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 03:21.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.