Page 1 of 1
Convert tiff -> pdf
Posted: 2008-01-07T08:43:40-07:00
by ropet
I'm trying to convert a tiff image to a pdf image. The tiff file is a tiffG4
It look okej but the pdf is not redable in adobe acrobat reader.
Do i do anny thing wrong ??
MagickWandGenesis();
wand = NewMagickWand();
status = MagickReadImage(wand,"c:\\1.tif");
status = MagickSetImageFormat(wand, "PDF" );
MagickGetImageBlob(wand,&ImageLen);
memcpy(*Image,FilePonter,ImageLen);
DestroyMagickWand( wand );
MagickWandTerminus();
infd = open("c:\\1.pdf", O_RDWR | O_CREAT);
write(infd,Image,ImageLen);
close(infd);
Re: Convert tiff -> pdf
Posted: 2008-01-07T08:54:32-07:00
by magick
This snippet reads an image in the TIFF format, converts it to PDF as an inline blob, and writes the result to disk:
- wand = NewMagickWand();
status = MagickReadImage(wand,"1.tif");
status = MagickSetImageFormat(wand, "PDF" );
blob = MagickGetImageBlob(wand,&length);
DestroyMagickWand( wand );
MagickWandTerminus();
infd = open("1.pdf", O_RDWR | O_CREAT, 0644);
write(infd,blob,length);
close(infd);
Re: Convert tiff -> pdf
Posted: 2008-01-07T10:17:39-07:00
by ropet
I copy your code and test it on my image. Iget one pdf but is not okej to display in acrobar reader.
I run the convert program on it, then it work ok.
My image is tiff tiffG4 black&white ( no grayscale or collor )
I test this under windows.
Version: ImageMagick 6.3.7 12/25/07 Q8
Re: Convert tiff -> pdf
Posted: 2008-01-07T11:42:58-07:00
by magick
Can you post a URL to your image, 1.tif? We converted a G4 TIFF image with the MagickWand program and the convert command and both produced a valid PDF image. We're using ImageMagick 6.3.7-9.
Re: Convert tiff -> pdf
Posted: 2008-01-07T13:03:07-07:00
by ropet
Can i send it by mejl ?
Re: Convert tiff -> pdf
Posted: 2008-01-08T05:27:13-07:00
by ropet
I have 2 test images on a webserver
http://ropet.mine.nu/Images/
001.TIF
002.TIF
thanks for all help i can get
Re: Convert tiff -> pdf
Posted: 2008-01-08T08:38:49-07:00
by magick
We tried your script with 001.TIF and 002.TIF and create 001.PDF and 002.PDF respectively and they both displayed without complaint with Adobe Acrobat 8.0. We're using ImageMagick 6.3.7-9.
Re: Convert tiff -> pdf
Posted: 2008-01-08T09:06:13-07:00
by ropet
This is my test program i get a pdf fil thet is blank ( white )
Code: Select all
int main(int argc,char **argv)
{
int ImageLen =0;
int infd;
MagickWand *wand;
unsigned char *blob;
size_t length;
MagickBooleanType status;
MagickWandGenesis();
wand = NewMagickWand();
status = MagickReadImage(wand,"c:\\tewmp\\001.tif");
status = MagickSetImageFormat(wand, "PDF" );
blob = MagickGetImageBlob(wand,&length);
infd = open("c:\\tewmp\\1.pdf", O_RDWR | O_CREAT, 0644);
write(infd,blob,length);
close(infd);
DestroyMagickWand( wand );
MagickWandTerminus();
}
Re: Convert tiff -> pdf
Posted: 2008-01-08T10:08:35-07:00
by magick
Download
http://www.virginimage.org/download/1.pdf, created with your code snippet.
Re: Convert tiff -> pdf
Posted: 2008-01-08T15:41:24-07:00
by ropet
I get the last version and make the test. And My pdf files is on
ropet.mine.nu/images
001.pdf
002.pdf
And they is not så god.
I runing under windows and vc++ 6
I have test Q8 and Q16
I see in the pdf file is generated whith Q16