Page 1 of 1

Improper image header error with raw pixel data

Posted: 2016-10-20T16:45:57-07:00
by konez
I'm using Magick++ to compress frames from a video file in order to reduce the overall size. The frames are extracted with FFMPEG and are raw pixel RGB data (8-bits). For the first 300 or so frames, the code runs with no problem, but it gets to a point where I'm getting a ErrorCorruptImage exception thrown.

terminate called after throwing an instance of 'Magick::ErrorCorruptImage'
what(): main: improper image header `' @ error/sct.c/ReadSCTImage/189

I don't know why it's trying to read a SCT image. There should be no image header with raw RGB data. Any insight is appreciated. The code snippet is shown below. The error is triggered on the last line. Essentailly, the raw frame data is stored in buffer and i'm making a blob from the already buffered data.

Code: Select all

    Magick::Blob blob;
    blob.updateNoCopy(buffer, 640*480*3);
  
    Magick::Image image;
    image.depth(8);
    image.size("640x480");
    image.magick("RGB");

    image.read(blob);
Thanks

Re: Improper image header error with raw pixel data

Posted: 2016-10-20T17:20:29-07:00
by snibgo
I can't answer the question. For those who can, it may help if you say what version number IM you are using. (Also platform, though I doubt that matters.)