Does anyone have vortex code for reading jpeg or gif headers and pulling out the image dimensions?
I can't seem to find a vortex function that will read markers from the files at certain byte offsets and keep moving until it gets to the start of frame segment with the image height and width info. I would hate to resort to a c program if vortex can do it...
Now that I have found the bit of the header I want, in this case the FFC0 marker in a JPEG file, how do I get to the stuff after it and before the next marker? The strfmt %!c seems to stop at null values in the binary data... and I can't seem to read offsets past a null value.
<strfmt "%!c"> only takes the first byte of its argument, since it only prints 1 ASCII value. <substr>, however, like its C counterpart, stops at nul in strings. You can use <rex> to pull out specific parts of a binary string without stopping at nul, since <rex> is full binary compatible: