extracting the thumbnail from digital photos?

Alejandro Tejada capellan2000 at gmail.com
Tue Jan 20 01:26:54 EST 2015


Hi Malte,

This button script extracts and displays a jpeg thumbnail
from this image:
http://216.18.212.226/PRODS/fuji-x100t/FULLRES/X100ThSLI00100NR2D.JPG

This sample jpeg image have two thumbnails:
160x120 and 320x240

on mouseUp
   local temp
   answer file "Select JPEG image with EXIF thumbnail data"
   put it into temp
   open file temp for binary read
   read from file temp for 100000 -- first 100k of jpeg binary data
   put it into temp1
   close file temp
   
   put numtochar(255) & numtochar(216) into tStart 
   -- in Hexadecimal: FFD8 = SOI(Start of jpeg image)

   put numtochar(255) & numtochar(217) into tEnd
   -- in Hexadecimal: FFD9 = EOI(End of jpeg image)
   
   delete char 1 to 4 of temp1 
   -- delete JPEG SOI (Start of jpeg image)

   if char -2 to -1 of temp1 = tEnd then delete char -2 to -1 of temp1 
   -- delete JPEG EOI(End of jpeg image)
   
   put char offset(tStart,temp1) to (offset(tEnd,temp1) + 1) of temp1 into
tJPGThumb
   -- this finds the first JPEG Thumbnail in the Data
   -- Some Digital Cameras store Two thumbnails
    
   if tJPGThumb is not empty
   then
      create img
      set the text of it to tJPGThumb
      -- put "Chars = " & the number of chars of tJPGThumb & cr & tJPGThumb
   else
      answer "No JPEG Thumbnail in this image"
   end if
end mouseUp

Have a nice week!

Al



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/extracting-the-thumbnail-from-digital-photos-tp4687985p4688039.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the Use-livecode mailing list