extracting the thumbnail from digital photos?

Alejandro Tejada capellan2000 at gmail.com
Tue Jan 20 01:50:17 EST 2015


Hi Malte,

This script extracts all thumbnails
from a jpeg image:

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
   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 2 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)
   
   repeat until offset(tStart,temp1) = 0
   
   put offset(tStart,temp1) into tThumbstart
   put offset(tEnd,temp1) into tThumbEnd
   
   put char tThumbstart to (tThumbEnd + 1) of temp1 into tJPGThumb
      
   delete char 1 to (tThumbEnd + 1) of temp1
   
   if tJPGThumb is not empty
   then
      create img
      set the text of it to tJPGThumb
   else
      answer "No JPEG Thumbnails in this image"
   end if
   
   end repeat
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-tp4687985p4688040.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list