getting a page from a PDF with core

[email protected]
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <CAGNS0RtaMsdO3DDR_9Hpw8KFWid+2YwsmE5ydS5+d48B7i6eZg@mail.gmail.com>
Hi all,

I'd like to open a PDF (or some other multi-page image type) with Core
and get a specific page. I can append a [number] to the filename, of
course, but I'd like to be able to do this with a memory buffer as
well, where no filename is around, and it would "feel" better to do it
with an int rather than setting a string.

I found the ->scene member, which seems to be what Wand uses, but I
can't get it to work. This test program seems to always render the
whole PDF and then pick out page zero:

-----------------------
/* compile with

   gcc -g -Wall magick.c `pkg-config GraphicsMagick --cflags --libs`

 */

#include <string.h>
#include <stdlib.h>

#include <magick/api.h>

int
main( int argc, char **argv )
{
        ImageInfo *image_info;
        Image *image;
        ExceptionInfo exception;

        InitializeMagick( NULL );

        GetExceptionInfo( &exception );
        image_info = CloneImageInfo( NULL );
        strncpy( image_info->filename, argv[1], MaxTextExtent );

        if( !(image = ReadImage( image_info, &exception )) ) {
                CatchException( &exception );
                return -1;
        }

        image->scene = atoi( argv[2] );

        strncpy( image->filename, argv[3], MaxTextExtent );

        if( !WriteImage( image_info, image ) ) {
                CatchException( &exception );
                return -1;
        }

        DestroyImage( image );
        DestroyImageInfo( image_info );
        DestroyMagick();

        return 0;
}
--------------

Ideally I'd like something that worked with current IM as well as GM.
I can dream!

John

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.