[CLOSE]Optimise Convert

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
mvs
Posts: 3
Joined: 2014-11-07T03:52:45-07:00
Authentication code: 6789

[CLOSE]Optimise Convert

Post by mvs »

Hello,

I have some PDG with ~100 pages to convert on 3 differents size JPG, my server take 1h30-2h to create the picture.

I have three command to done this :

C:\ImageMagick\convert.exe -limit memory 12GiB -limit map 12GiB -density 300 c:\1.pdf -resize 200x266 -interlace none -density 72 -quality 80 c:\jpg\200_266_page.jpg"
C:\ImageMagick\convert.exe -limit memory 12GiB -limit map 12GiB -density 300 c:\1.pdf -resize 1536x2048 -interlace none -density 72 -quality 80 c:\jpg\1536_2048_page.jpg"
C:\ImageMagick\convert.exe -limit memory 12GiB -limit map 12GiB -density 300 c:\1.pdf -resize 2048x2730 -interlace none -density 72 -quality 80 c:\jpg\2048_2730_page.jpg"

This commands are called by a script php with the command exec.

The limit memory and map seems don't work

Do you an idea to help me to optimize my job

Thanks a lot
Last edited by mvs on 2014-11-07T08:51:28-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Optimise Convert

Post by snibgo »

You are rasterizing the same PDF three times. This can be done just once. Windows BAT syntax:

Code: Select all

C:\ImageMagick\convert.exe ^
  -limit memory 12GiB -limit map 12GiB -density 300 ^
  c:\1.pdf ^
  -interlace none -density 72 -quality 80 ^
  ( -clone 0--1 -resize 200x266 -write c:\jpg\200_266_page.jpg" -delete 0--1 ) ^
  ( -clone 0--1 -resize 1536x2048 -write c:\jpg\1536_2048_page.jpg" -delete 0--1 ) ^
  -resize 2048x2730 c:\jpg\2048_2730_page.jpg"
snibgo's IM pages: im.snibgo.com
mvs
Posts: 3
Joined: 2014-11-07T03:52:45-07:00
Authentication code: 6789

Re: Optimise Convert

Post by mvs »

thanks for your replay

It seems faster with a 10 page PDf but I have an error message with the last line :

Code: Select all

C:\ImageMagick\convert.exe -limit memory 12GiB -limit map 12GiB -density 300 "E:/www/test_img/4/1_pdfsam_B175_fusion-tablette-150dpi.pdf" -interlace none -density 72 -quality 80 ^ ( -clone 0--1 -resize 200x266 -write E:/www/test_img/4/jpg/200_266_page.jpg ^
 ( -clone 0--1 -resize 1536x2048 -write E:/www/test_img/4/jpg/1536_2048_page.jpg ^
-resize 2048x2730 E:/www/test_img/4/jpg/2048_2730_page.jpg
Error Message :

Code: Select all

convert.exe: unbalanced parenthesis 'E:/www/test_img/4/jpg/2048_2730_page.jpg'
@ error/convert.c/ConvertImageCommande/3039
Do you have an idea ?

Thanks a lot


Edit :

Ok i erase the end of the line clone...

It's ok now

Code: Select all

C:\ImageMagick\convert.exe -limit memory 12GiB -limit map 12GiB -density 300 "E:/www/test_img/4/1_pdfsam_B175_fusion-tablette-150dpi.pdf" -interlace none -density 72 -quality 80 ^ ( -clone 0--1 -resize 200x266 -write E:/www/test_img/4/jpg/200_266_page.jpg -delete 0--1 ) ^
 ( -clone 0--1 -resize 1536x2048 -write E:/www/test_img/4/jpg/1536_2048_page.jpg -delete 0--1 ) ^
-resize 2048x2730 E:/www/test_img/4/jpg/2048_2730_page.jpg
Thanks you for your help I'll try on my server
mvs
Posts: 3
Joined: 2014-11-07T03:52:45-07:00
Authentication code: 6789

Re: Optimise Convert

Post by mvs »

Il very slow so i'll try another way and it's succed. I make 5 jpg by page in 10min

For that i make my treatment page by page with a while in php and it will be very faster!!

If that post can help someone !!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [CLOSE]Optimise Convert

Post by snibgo »

On a 94-page A4 PDF, my command on my laptop (Windows 8.1) takes 1m54s, roughly 1 page per second. I don't know why yours is much slower.
snibgo's IM pages: im.snibgo.com
Post Reply