WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
ImageMagick and image manipulation (Read 6033 times)
kenobee
YaBB Newbies
*
Offline



Posts: 7
ImageMagick and image manipulation
Apr 21st, 2006 at 12:39am
 
Anyone have experience with ImageMagick (http://www.ImageMagick.org)
to automate and convert PDF or EPS to JPG thumbnail, like => WD plugin process "Automatically Create Thumbnails"

I would like to have the same process like "Automatically Create Thumbnails" specialy the tree folder (reccursive) mirror for originals and thumbnails.

And make multiple JPG from a multi page PDF, exemple 3 pages pdf = multipage.pdf => multipage001.jpg, multipage002.jpg, multipage003.jpg...
I don't know if it is possible to extract the page number of a PDF and include it in the file name?

Thanks for your help
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: ImageMagick and image manipulation
Reply #1 - Apr 21st, 2006 at 4:52am
 
Hi,

Below is a .bat script I wrote for someone that uses the imagemagick "convert" commandline tool:
Code:
@ECHO OFF

rem
rem the directory where ImageMagick is installed
rem do NOT end it with a backslash
rem do NOT put "quotes" around the name..
rem

SET CVT=C:\Program Files\ImageMagick-6.2.1-Q16


rem
rem where to place the resized/rotated pictures (directory name)
rem do NOT end it with a backslash
rem do NOT put "quotes" around the name..
rem

SET TRG=D:\Temp



GOTO %WD_REASON%

:FILENEW

rem check if this is a JPG file
IF "%WD_FILE_E%" NEQ "JPG" GOTO :Done



"%CVT%\convert.exe" "%WD_FILE%" -rotate "-90" -resize 4%% "%TRG%\%WD_FILE_N%"
GOTO Done



:DIRCHNG
:FILECHNG
:FILEDEL
:DIRDEL
:DIRNEW
:FILEREN
:DIRREN
:QUIET
GOTO Done


:Done
Echo Thats it!
 



Use the batch file plugin to start it for new files.
Note that this script rotates and resized JPG files, nothing more. See the imagemagick convert page for other options.

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
kenobee
YaBB Newbies
*
Offline



Posts: 7
Re: ImageMagick and image manipulation
Reply #2 - Apr 21st, 2006 at 11:31am
 
Thank you
I try your bat file and it work fine with JPG file
I am not a developper but only a key user...
...could you help me to make the same think with input *.EPS and *.PDF and output *.JPG ?

Was it possible to have the same as "Automatically Create Thumbnails" plugIn ?
Specialy the fonction : "Place them in sub directories corresponding to the location of the original"
and resize to fit = 512 x 512 and other options

The ideal think is to use ImageMagik instead of GD, in your plug in, Is'nt it ?

Thanks

Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: ImageMagick and image manipulation
Reply #3 - Apr 22nd, 2006 at 12:22pm
 
Ok,

try the script below instead. Besides ImageMagick, you also need to install Ghostscript to properly manipulate PDF files.

download/install ghostscript:
http://sourceforge.net/project/showfiles.php?group_id=1897&package_id=108733
(choose the gs850w32-gpl.exe download)


Code:
@ECHO OFF

rem
rem the directory where ImageMagick is installed
rem do NOT end it with a backslash
rem do NOT put "quotes" around the name..
rem

SET CVT=C:\Program Files\ImageMagick-6.2.1-Q16


rem
rem where to place the converted pictures (directory name)
rem do NOT end it with a backslash
rem do NOT put "quotes" around the name..
rem

SET TRG=D:\Temp

rem
rem place output files in "same sub-directory"?
rem Y or N

SET SAMESUB=Y

rem
rem width/height settings...
rem
rem  400x400   - resizes while maintaining correct aspect-ratio (resize to fit)
rem  400x200!  - resizes to 400 (width) x 200 (height), ignores aspect ratio
rem

SET RESIZE=400x400

rem
rem output file format
rem   for example JPG
rem

SET FORMAT=jpg


GOTO %WD_REASON%

:FILENEW
SET TARGETDIR=%TRG%
IF "%SAMESUB%" EQU "Y" Call :CreateSub


"%CVT%\convert.exe" -resize %RESIZE% "%WD_FILE%" "%TARGETDIR%\%WD_FILE_B%.%FORMAT%"
GOTO Done


GOTO :EOF
:CreateSub
IF "%WD_RELDIR%" EQU "" GOTO :EOF
SET TARGETDIR=%TARGETDIR%\%WD_RELDIR%
MD "%TARGETDIR%"
GOTO :EOF




:DIRCHNG
:FILECHNG
:FILEDEL
:DIRDEL
:DIRNEW
:FILEREN
:DIRREN
:QUIET
GOTO Done


:Done
Echo Thats it!
 


Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
kenobee
YaBB Newbies
*
Offline



Posts: 7
Re: ImageMagick and image manipulation
Reply #4 - Aug 29th, 2006 at 5:07pm
 
Hello,
There is 3 month i use watchdirectory with ghostscript and image magick and it work fine
Anyone could help me to make a new script ?
Input is an EPS CMYK file from photoshop 1200 x 1500px (300 dpi) and i would like a JPG RGB output exactly in the same size = 1200 x 1500px (300 dpi) : here is my actual script


@ECHO OFF
rem
rem the directory where ImageMagick is installed
rem do NOT end it with a backslash
rem do NOT put "quotes" around the name..
rem

SET CVT=C:\Program Files\ImageMagick-6.2.7-Q16

rem
rem where to place the converted pictures (directory name)
rem do NOT end it with a backslash
rem do NOT put "quotes" around the name..
rem

SET TRG=F:\KNOWBOX-DATAS\NEW\PHOTOS\ARN\preview500

rem
rem place output files in "same sub-directory"?
rem Y or N

SET SAMESUB=Y

rem
rem width/height settings...
rem
rem  400x400   - resizes while maintaining correct aspect-ratio (resize to fit)
rem  400x200!  - resizes to 400 (width) x 200 (height), ignores aspect ratio
rem

SET RESIZE=500x500

rem
rem output file format
rem   for example JPG
rem

SET FORMAT=jpg

GOTO %WD_REASON%

:FILENEW
SET TARGETDIR=%TRG%
IF "%SAMESUB%" EQU "Y" Call :CreateSub

"%CVT%\convert.exe" -profile C:\icc\EuroscaleCoated.icc -profile C:\icc\srgb.icm -resize %RESIZE% "%WD_FILE%" "%TARGETDIR%\%WD_FILE_B%.%FORMAT%"
GOTO Done

GOTO :EOF
:CreateSub
IF "%WD_RELDIR%" EQU "" GOTO :EOF
SET TARGETDIR=%TARGETDIR%\%WD_RELDIR%
MD "%TARGETDIR%"
GOTO :EOF

:DIRCHNG
:FILECHNG
:FILEDEL
:DIRDEL
:DIRNEW
:FILEREN
:DIRREN
:QUIET
GOTO Done

:Done
Echo Thats it!
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: ImageMagick and image manipulation
Reply #5 - Aug 30th, 2006 at 5:31am
 
Have you tried to remove the resize-option from the script?
Near the bottom of the script is the commandline for imagemagick:
Code:
"%CVT%\convert.exe" -profile C:\icc\EuroscaleCoated.icc -profile C:\icc\srgb.icm -resize %RESIZE% "%WD_FILE%" "%TARGETDIR%\%WD_FILE_B%.%FORMAT%" 


change that to
Code:
"%CVT%\convert.exe" -profile C:\icc\EuroscaleCoated.icc -profile C:\icc\srgb.icm "%WD_FILE%" "%TARGETDIR%\%WD_FILE_B%.%FORMAT%" 



I guess that should work.

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
kenobee
YaBB Newbies
*
Offline



Posts: 7
Re: ImageMagick and image manipulation
Reply #6 - Aug 30th, 2006 at 7:58am
 
Thank you, I am stupid ! some time you search your keys and they are in your hand...

Bye
Didier
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1