From Blob with MPG to PPM Image failure

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jrosinski

From Blob with MPG to PPM Image failure

Post by jrosinski »

Hello,

i have frames from an imx-Movie (MPG with I-Frame only) and want do get the frames as ppm-Image with Magick++.

First i read it in a blob and then i want to generate an Image from it:

Blob blob(buffer, length);
Image image(buffer);
image.write("test.jpg");

But the Image is empty. When i manipulate the delegates, so that i can see status (use mpeg2decoder without -q) of the decoder i see, that the Image-constructor use mpeg2decoder to generate an ppm-Image in /tmp/...
But in the next step the constructor doesn't read this created temp-Image in so it generates an empty one.

When i use instead a

image.read("/tmp/filename.ppm");

before, it functions correctly.

What i made wrong?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: From Blob with MPG to PPM Image failure

Post by anthony »

You need to convert the blob to an image, not just use it or read it.
See API manual.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jrosinski

Re: From Blob with MPG to PPM Image failure

Post by jrosinski »

I just tried something like

image.magick("JPG");

but also didn't create a correct image, which i can write to disk.

Can you post a quick solution please?
Post Reply