@@ -410,20 +410,21 @@ jpegSize img =
410410
411411jfifSize :: ByteString -> Either String ImageSize
412412jfifSize rest =
413− let [dpiDensity,dpix1,dpix2,dpiy1,dpiy2] = map fromIntegral
414− $ unpack $ B.take 5 $B.drop 9 rest
415− factor = case dpiDensity of
416− 1 -> id
417− 2 -> \x -> x * 254 `div` 10
418− _ -> const 72
419− dpix = factor (shift dpix1 8 + dpix2)
420− dpiy = factor (shift dpiy1 8 + dpiy2)
421− in case findJfifSize rest of
422− Left msg -> Left msg
423− Right (w,h) ->Right ImageSize { pxX = w
413+ case map fromIntegral $ unpack $ B.take 5 $ B.drop 9 rest of
414+ [dpiDensity,dpix1,dpix2,dpiy1,dpiy2] ->
415+ let factor = case dpiDensity of
416+ 1 -> id
417+ 2 -> \x -> x * 254 `div` 10
418+ _ -> const 72
419+ dpix = factor (shift dpix1 8 + dpix2)
420+ dpiy = factor (shift dpiy1 8 + dpiy2)
421+ in case findJfifSize rest of
422+ Left msg -> Left msg
423+ Right (w,h) -> Right ImageSize { pxX = w
424424 , pxY = h
425425 , dpiX = dpix
426426 , dpiY = dpiy }
427+ _ -> Left "unable to determine JFIF size"
427428
428429findJfifSize :: ByteString -> Either String (Integer,Integer)
429430findJfifSize bs =