JPEG画像の破損チェック

AppleScript名:JPEG画像の破損チェック
— Created 2006-10-17 by Somebody
— Modified 2015-10-06 by Takaaki Naganoya

set aFile to choose file of type {"public.jpeg"}
set dRes to VerifyCompleteJPEG(aFile) of me

— to verify whether a JPEG is a111 full or partial (e.g. partially downloaded) JPEG
— last two JPEG file bytes must be (ASCII character 255) & (ASCII character 217)
on VerifyCompleteJPEG(f)
  try
    set s to read f from -2 for 2
  on error
    return false –error "JPEG image is too short or currupted"
  end try
  
  
if s = (ASCII character 255) & (ASCII character 217) then
    return true
  else
    return false
  end if
end VerifyCompleteJPEG

★Click Here to Open This Script 

Please follow and like us:

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です