Page 1 of 1

How to convert PDF to TIF with PascalMagick / MagickWand

Posted: 2015-10-07T08:15:37-07:00
by fimmenroth
Hello,

i need to convert PDF to TIF and use MagickWand (with PascalMagick). On commandline I managed to convert the file perfectly with

Code: Select all

convert -density 200 -flatten 315a743.pdf[0] temp.tif
With MagickWand API I only get a very bad imagequality (72 dpi???). I need to translate both, the -density and the -flatten options to MagickWand.

Here is the sourcecode so far:

Code: Select all

begin
      MagickWandGenesis;
      wand := NewMagickWand;
      MagickSetImageResolution(wand,200,200);
//      wand:=MagickFlattenImages(wand);  ---> No entrypoint in CORE_RL_wand.DLL????
      MagickReadImage(wand, PChar(UTF8ToSys('315a743.pdf[0]')));
      MagickWriteImage(wand,PChar('temp.tif'));
       
      ...
   
end          
Any help is welcome.

Thank you
Florian

Re: How to convert PDF to TIF with PascalMagick / MagickWand

Posted: 2015-10-07T12:05:56-07:00
by dlemstra
Which version of ImageMagick are you using?

Re: How to convert PDF to TIF with PascalMagick / MagickWand

Posted: 2015-10-08T02:01:51-07:00
by fimmenroth
I use the DLLs of 6.8.9-Q16 on Win32.

Re: How to convert PDF to TIF with PascalMagick / MagickWand

Posted: 2015-11-30T05:53:59-07:00
by hawk1218
Hello,

I have the same problem with version 6.9.2-7 Q16 (with svg file)

Command line works :

Code: Select all

convert -density 200 a.svg a.png
API don't work:

Code: Select all

  MagickWandGenesis();
  magick_wand=NewMagickWand();  
  status=MagickSetResolution(magick_wand,1000,1000);
  if (status == MagickFalse)
    ThrowWandException(magick_wand);
  status=MagickReadImage(magick_wand,argv[1]);
  if (status == MagickFalse)
    ThrowWandException(magick_wand);

  printf("width=%d, height=%d\n", MagickGetImageWidth(magick_wand),  MagickGetImageHeight(magick_wand));

  status = MagickResizeImage( magick_wand, 1000, 1000, LanczosFilter, 1.0);

  if ( status == MagickFalse )
    ThrowWandException(magick_wand);
 
  status=MagickWriteImages(magick_wand,argv[2],MagickTrue);
  if (status == MagickFalse)
    ThrowWandException(magick_wand);
  magick_wand=DestroyMagickWand(magick_wand);
  MagickWandTerminus();
MagickSetResolution(magick_wand,1000,1000) seem to have no effect (width and height not change even if we change resolution)

Thanks in advance