extracting the thumbnail from digital photos?

Paul Hibbert paul at livecode.org
Wed Jan 28 11:43:49 EST 2015


Thank you Alejandro for posting this. I've tried it on OS X and found it works well.

I've also tried it with the JPEGS straight from a Nikon camera and it works with them too, and it works on PSD files that are saved with a thumbnail image.

Regards,

Paul

> On Jan 26, 2015, at 3:59 PM, Alejandro Tejada <capellan2000 at gmail.com> wrote:
> 
> Hi,
> 
> This script works in LiveCode 7.0.1
> under Windows:
> 
> (Notice that I am using byte instead of char
> as recommended in release notes and,
> unlike Ubuntu, I have to set the casesensitive
> to true to make it work)
> 
> First, download this 8 MB image that contains
> two thumbnails (320x240 and 160x120):
> (this link should be in a single line)
> 
> http://216.18.212.226/PRODS/fuji-x100t/FULLRES/X100ThSLI00100NR2D.JPG
> 
> Create a stack and put this script
> in a button:
> 
> 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 numtobyte(255) & numtobyte(216) into tStart
>  -- in Hexadecimal: FFD8 = SOI(Start of jpeg image)
>  put numtobyte(255) & numtobyte(217) into tEnd
>  -- in Hexadecimal: FFD9 = EOI(End of jpeg image)
> 
>  delete byte 1 to 2 of temp1
>  -- delete JPEG SOI (Start of jpeg image)
>  if byte -2 to -1 of temp1 = tEnd then delete byte -2 to -1 of temp1
>  -- delete JPEG EOI(End of jpeg image)
> 
>  set the casesensitive to true
> 
> 
> repeat until offset(tEnd,temp1) = 0
> 
> -- repeat until offset(tStart,temp1) = 0
> 
>  put offset(tStart,temp1) into tThumbstart
>  put offset(tEnd,temp1) into tThumbEnd
> 
>  put byte tThumbstart to (tThumbEnd + 1) of temp1 into tJPGThumb
> 
>  delete byte 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
> 
> Al
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list