composite, adding watermark and speed

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ed44rf
Posts: 4
Joined: 2016-08-02T22:37:59-07:00
Authentication code: 1151

composite, adding watermark and speed

Post by ed44rf »

i have a multypage pdf file, i need to put a watermark on each page in pdf. also i need to set opacity, size and position of watermark
it must work on linux command line
i googled but can't find any complete example, so i use such solution-split pdf on single page, then call command and put watermark on each pdf

Code: Select all

composite -gravity NorthEast -density 200 -dissolve 50 -size 50x30 -geometry +100+50 watermark.jpg pdf1.pdf pdf1.pdf 
then merge all files into 1 pdf
the main problem is the speed- if density is 100 or more then speed is slow, if lower then poor quality of pdf files
can you give some ideas?
may be any example to put watermark on whole pdf, or may be increase speed?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: composite, adding watermark and speed

Post by snibgo »

See my response on a similar thread: viewtopic.php?f=27&t=30203
snibgo's IM pages: im.snibgo.com
ed44rf
Posts: 4
Joined: 2016-08-02T22:37:59-07:00
Authentication code: 1151

Re: composite, adding watermark and speed

Post by ed44rf »

thanks, but this is the one way to set watermark with such params
is any way to increase speed with high quality?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: composite, adding watermark and speed

Post by snibgo »

It depends on why you get "poor quality". If the input PDFs contain vector elements (such as plain text), then a speed/quality tradeoff is inevitable. If it contains only raster images, then I suggest you extract them with pdfimages, add your watermark to those, and reassemble into PDF files.

There are probably tools out there somewhere to add PNG watermarks to PDF files without rasterizing vectors.
snibgo's IM pages: im.snibgo.com
ed44rf
Posts: 4
Joined: 2016-08-02T22:37:59-07:00
Authentication code: 1151

Re: composite, adding watermark and speed

Post by ed44rf »

pdf file contain just text
also i use command

Code: Select all

convert img pdf
and it work good

i googgled any other solutions but they not completed
for example mpdf can't change position of watermark (i need right top corner)
Post Reply