http://qs1969.pair.com?node_id=11143935


in reply to Re^2: Create image from pixel values with Imager
in thread Create image from pixel values with Imager

Without more information, I can only guess, but it sounds like an off-by-one error. In your OP: "65536 values from 0-254". That suggests a 255x255 square which is 65025 values; a 256x256 square is 65536 values. Do you perhaps want to start with "65536 values from 0-255"?

Update: s/off-by-error/off-by-one error/

— Ken

Replies are listed 'Best First'.
Re^4: Create image from pixel values with Imager
by Anonymous Monk on May 17, 2022 at 12:39 UTC
    > Do you perhaps want to start with "65536 values from 0-255"?

    Exactly (but my data doesn't have any 255 value, 254 is highest). I don't think that's the problem because ImageMagick can convert the packed array to an image and it looks good. I don't know much about image formats or binary data. I learned that the array has to be packed like that by digging in this source code for Image::BMP.

      Heres an idea, don't use data option