>At 8:17 AM +1000 on 12/20/00, Robert (actually) wrote: >> > One can print out a number in Hex using PRINT HEX$(256), etc. >>> >> > How does one get the number back out of Hex'ed data? Heather replies: >I was going to mention this before my ISP crashed. >The original question was about writing hex data to a file to create >a TIFF header and also read that data back. >Unless I misunderstand what has been said in this thread, it sounds >like you are trying to read and write HEX strings in the data fork. That is correct. >Robert Covington's original post on TIFF code shows this to write the header: > >/* Write the header */ > WriteHexString(fptr,"4d4d002a"); >/* Little endian & TIFF identifier */ > >Instead of dealing with strings, it would seem easier to write the >hex data directly. Yes, that is what I was after. :) >Something like this would write the header: >//little endian header >DIM headerIBM&`: headerIBM& = 0x4949002a // II > >// big endian header >DIM headerMAC&`: headerIBM& = 0x4d4d002a // MM >OPEN "D",#1,"SomePicture.tiff",1,tempVRef,tempDirID >WRITE #1, headerMAC&` <snip> >Could be done like this in FB^3: <snip> >Reading the data back should be pretty simple, unless I don't have a >clue what Robert is doing. Thank you for that exposition. Bourke's writing of the TIFF code is a little different than others do it. He puts the majority of tags after the image as a footer, whereas most of the programs I encounter have them all up top. But that is pretty much what I was wanting to know as far as translating his code. Reading the data back in is simple, as long as your images contain the tags you look for. However, after a read of the TIFF specs, they mention that accounting for all the tag variations by any one reader is a difficult proposition. Graphic Converter does great I can vouch, my corrupted TIFF files still got read when Photoshop barfed. However, I take the easy route for reading TIFF, and use Quicktime. The problem I had all night that elicited Wahoo-ville, is that the resolution info was getting written as a long, and it was supposed to be a rational. Once that parameter got fixed, suddenly Quicktime stopper barfing when reading the files. Thank you Heather, for your time and code help in understanding this hex'ing problem. Robert Covington