procedure generate terrain using a Jpg

I was wondering how I can use a jpg instead of a raw file to generate a terrain in unity via code.
What I want to do is to get a jpg off a server or my computer and then use that to generate the terrain. So far all Ive seen has been using raw format.

So basically I was thinking like this
1: Apply a texture i.e. the height map of the terrain i want to model to a mesh.
2: Loop though each vertex of the mesh and get the color of the pixel 0-1 value
3: Base the height Y of the mesh on that value according to the max height index like 1500 ft for a mountain or what not.

I think this would work it seams like it would any thought or improvement to this?
Thanks for any help with this

Your algorithm sounds good to me. Maybe it would be easier after all to convert to PNG, if you can find a library for the conversion.

Also for your algorithm, since you only do it once on start-up, I would probably do it on the CPU, instead on the GPU for easier debugging and stuff.