Richard Kaye wrote:
> Like Tracy, I attempt to answer my own questions. <g> Here's what I've 
> figured out for anyone who might find this useful.
> 
> In order to identify a file with a JPG extension that isn't really a JPG, 
> examine the ASCII values of the first 2 characters. The first two ASCII 
> values of a JPG are:  ASCII 255 & ASCII 216 (0xFF 0xD8). If the first two 
> characters don't match those two values, the file is not a JPG. (If you want 
> to be more precise about it, you can actually look for other values in 
> specific positions in roughly the first ~16 characters but checking the first 
> 2 characters is good enough for my purposes at the moment.)
> 
> In order to identify a truncated JPG, examine the last 2 characters. The 
> ASCII values for last two characters of a JPG are ASCII 255 & ASCII 217 (0xFF 
> 0xD9). If the last two characters don't match those two values, then image 
> data is missing.
> 
> The minimum file size for a JPG, as best I can determine is 304 bytes. Any 
> file smaller than that is corrupt and contains no image info at all. 
> 
> There are many ways to do these tests in VFP so I'm not bothering to post any 
> code here. If anyone is interested in my solution, let me know and I'll post 
> some snippets.


Very cool.

-- 
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to