Twinside / Juicy.Pixels

Haskell library to load & save pictures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reading JPEG fails?

phadej opened this issue · comments

See phadej/JuicyPixels-scale-dct#4

There is a test image, if I do a simple conversion:

test = do
    Right dimg <- readImage "cat.png
    let img = convertRGBA8 dimg
    writePng "tmp.png" img

I'll get cyan/blue image as in the report.

Is there a way to debug that?

I can confirm that test working. I wrote the following code:

import Codec.Picture
import Codec.Picture.ScaleDCT

main :: IO ()
main = do
  Right dtest1 <- readImage "cat.jpg"
  Right dtest2 <- readImage "cat.png"
  let test1 = convertRGBA8 dtest1
      test2 = convertRGBA8 dtest2
  writePng "test1.png" test1
  writePng "test2.png" test2

The resulting picture test1.png is garbled, whereas test2.png is perfectly fine.

This bug seems to have something to do with the file size of the jpeg image that's being read. I have other jpegs in my gallery, which also have been processed with this library, but are not garbled. All they have in common is, that they are smaller in size.

Reproduced, I'll have a look

I hate progressive Jpeg so much it's not even funny. Updated package uploaded to Hackage, version 3.2.8

thanks a lot.