Page 1 of 2
(Solved) Compose image to pdf
Posted: 2011-02-17T12:46:44-07:00
by jmituzas
I am very new to Image Magick and loving it so far, but have came across a problem.
While just running some tests to see if it can accomplish our needs I have come across a problem with composing a graphic into a pdf.
First test was Composing an image onto another Image, this worked out great
Code: Select all
composite -compose Copy caption.gif -gravity East -geometry +200-100 webcard.jpg Card.jpg
The .Gif isn't anything but text, and I wanted it to overlay or merge with another image, this worked out great.
Upon trying the same thing with a pdf:
Code: Select all
composite -compose Copy caption.gif -gravity East -geometry +200-100 test.pdf Card.pdf
I ended up with a terrible resolution and a black background for the overlaying "caption.gif"
anyway to fix this so I can use it? A way to specify pdf resolution for print quality (350dpi.) and away to get rid of the background?
This background gave me problems also when trying my first test with using an .svg image.
Any help will be greatly appreciated!
Thanks in advance,
Joe
Re: Compose image to pdf
Posted: 2011-02-17T12:59:28-07:00
by fmw42
pdf is a vector format and does not have any real pixel resolution. Thus you need to tell the pdf when reading it what density you want such as 350 dpi. To do that you need to use -density and -units commands. Also I would suggest you use convert ... -composite rather than composite as convert is more flexible.
see
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/formats/#pdf
http://www.imagemagick.org/Usage/formats/#vector
http://www.imagemagick.org/script/comma ... p?#density
The black background issue may be due to the particular ghostscript device that is being used. You may have to edit that in the delegates.xml file. But I am not an expert on that. One delegate allows multipage pdfs, but not transparency. Another allows transparency, but not multipage pdfs. That is about all that I know.
Re: Compose image to pdf
Posted: 2011-02-17T13:03:58-07:00
by jmituzas
Thanks for the quick response will look into this, and I am only working with single page pdf files so that is good.
By any chance would you by chance where delegates.xml would be located, I am currently using Ubuntu?
Thanks for the info,
Joe
Re: Compose image to pdf
Posted: 2011-02-17T13:30:07-07:00
by jmituzas
OK upon trying to find my delegates.xml file I have ran
reported back
Code: Select all
DELEGATES bzlib djvu freetype gvc jpeg jp2 lcms openexr png tiff x11 xml wmf zlib
and checked out the
http://www.imagemagick.org/download/delegates/
but nothing stating .pdf which delegate is for .pdf files?
Re: Compose image to pdf
Posted: 2011-02-17T13:43:55-07:00
by fmw42
ghostscript which should show up as gs in the Delegates list. I am not sure what gvc is? But the ghostscript device may need to be edited in your delegates.xml file. But work on one problem at a time. Try adding -density 350 before your input pdf and see if that helps.
My delegates are:
DELEGATES bzlib fftw fontconfig freetype gs jpeg jng jp2 lcms lqr openexr png tiff x11 xml zlib
Re: Compose image to pdf
Posted: 2011-02-18T06:38:00-07:00
by jmituzas
Let me start over, maybe I am going about this wrong. (I am very new to ImageMagic)
Maybe it would be easier if I explained the project at hand to be sure that I am using the best resources available.
We were using Adobe InDesign with the Datamerge feature, we needed this because it was a way for us to produce multiple cards and marketing materials with there own card. But can not use it anymore because we need this process to be automated and InDesign can't help us with that.
Each card has the same look the only changes on each one are the group number and the url to there website.
so you know what these cards look like please go to:
http://www.rxcut.com/bishop/en/Landing1.html (thats with a text co-branded logo)
http://www.rxcut.com/FirstHarbor (that one has a tri-branded card)
Webcards are 96dpi and print cards are 350dpi. All of the marketing materials are one full page pdf each.
Question is what would be the best format for ImageMagic to produce the graphic cards? I have found jpegs to work really well, not so much luck with .svg or .png.
And also, what would be the best way to produce our marketing materials?
These are similar to the cards in the aspect that they are merged with there own card on each one and get there logo within the header. Have thought about a jpeg then converting to a pdf, but this would probably end with the .pdf size being too large.
Re: Compose image to pdf
Posted: 2011-02-18T07:54:16-07:00
by jmituzas
Have tried out those links you sent but no luck! Images are still looking very pixelated. Also just tried a simple convert card.jpg card.pdf
shows nothing but a black page leaving my caption.gif that was composed onto the card.jpg the only thing visible.
I think I have something messed up! Thinking of re-installing from source rather then apt-get install imagemagic --fix-missing.
Should I install the delegates before or after or does it matter?
Re: Compose image to pdf
Posted: 2011-02-18T10:32:54-07:00
by fmw42
Install delegates before IM
Re: Compose image to pdf
Posted: 2011-02-18T12:01:13-07:00
by jmituzas
well thanks although I have installed the delegates.. ImageMagick wont install correctly from source:
I have done
./configure
make
make install
tested and here is the output:
user@host:~/Desktop/ImageMagick-6.6.7-7$ display
display: error while loading shared libraries: libMagickCore.so.4: cannot open shared object file: No such file or directory
user@host:~/Desktop/ImageMagick-6.6.7-7$ identify -list configure
identify: error while loading shared libraries: libMagickCore.so.4: cannot open shared object file: No such file or directory
now it wont let me install from apt-get install imagemagick either...
Re: Compose image to pdf
Posted: 2011-02-18T12:08:21-07:00
by fmw42
Sorry, but I am not an expert on Linux. You will need some one more knowledgeable than I for installation issues.
but see
http://www.imagemagick.org/script/advan ... lation.php
perhaps that may help
Re: Compose image to pdf
Posted: 2011-02-18T12:15:14-07:00
by jmituzas
Thanks I fixed the install had to go to the package manager and re-install the core
but now after I had installed the delegates it appears I have less then before? And still with no ghostscript
DELEGATES fontconfig freetype jpeg jng png x11 zlib
Will keep at it, something has to work.
Re: Compose image to pdf
Posted: 2011-02-18T12:48:16-07:00
by jmituzas
Ok this is starting to be a bit frustrating...
Code: Select all
identify -list configure
Path: /usr/local/lib/ImageMagick-6.6.7/config/configure.xml
Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -fopenmp -g -O2 -Wall -pthread
CONFIGURE ./configure '--with-gslib'
COPYRIGHT Copyright (C) 1999-2011 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick
CXX g++
CXXFLAGS -g -O2 -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES fontconfig freetype jpeg jng png x11 zlib
as you can see
CONFIGURE ./configure '--with-gslib'
but still no gs in the delegates... maybe I should hit up the Ubuntu forums since this doesn't seem to be an issue with ImageMagick
Re: Compose image to pdf
Posted: 2011-02-18T13:57:52-07:00
by fmw42
be sure that your delegates are installed in /usr/local/bin and /usr/local/lib. perhaps your previous ones were installed elsewhere. so you may need to reinstall any delegates including ghostscript that you want to have. Then reinstall IM.
Re: Compose image to pdf
Posted: 2011-02-18T15:36:05-07:00
by jmituzas
Good call. Wont be able to test till Monday.
thanks I will try but it maybe because I am using 64-bit, have read somewhere from google that I may have to move those files to /lib64
but If these don't work I think I may switch to CentOS and give the .rpm install a shot.
Thank you so much for your help.
This seems to be an amazing app and soon I will get to experience it!
Re: Compose image to pdf
Posted: 2011-02-18T16:20:56-07:00
by fmw42