Improper image header error with raw pixel data

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
konez
Posts: 1
Joined: 2016-10-20T16:37:21-07:00
Authentication code: 1151

Improper image header error with raw pixel data

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Improper image header error with raw pixel data

Post 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.)
snibgo's IM pages: im.snibgo.com
Post Reply