How to convert PDF to TIF with PascalMagick / MagickWand

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
fimmenroth
Posts: 2
Joined: 2015-10-07T08:07:11-07:00
Authentication code: 1151

How to convert PDF to TIF with PascalMagick / MagickWand

Post 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
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

Which version of ImageMagick are you using?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
fimmenroth
Posts: 2
Joined: 2015-10-07T08:07:11-07:00
Authentication code: 1151

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

Post by fimmenroth »

I use the DLLs of 6.8.9-Q16 on Win32.
hawk1218
Posts: 1
Joined: 2015-11-30T05:33:44-07:00
Authentication code: 1151

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

Post 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
Post Reply