1

Batch script to print multiple images in a single Letter size (1200x800px) sheet, layout upto 300 pics fit in 1 sheet. this can't be done on Windows photo printing wizard, unless the pic is crop or lose data. SO d idea is to resize pic & divide sheet using batch script, html & IE. here is code snippet, need to simplyfy it upto 300 (Plz run it once before answer..!)

Print.cmd
@echo off &title ThumPic (siva) &color 3f & DEL "c:\zz.html"
setlocal EnableDelayedExpansion
:j
set j=200
set u=0
set o=0
set /p j=How many in a page?
set /p o=Prez1 to print name?
if %j% LEQ 2 goto p1
if %j% LEQ 4 goto p2
if %j% LEQ 6 goto p3
if %j% LEQ 9 goto p4
if %j% LEQ 12 goto p5
if %j% LEQ 16 goto p6
if %j% LEQ 20 goto p7
if %j% LEQ 25 goto p8
if %j% LEQ 30 goto p9
if %j% LEQ 36 goto p10
if %j% LEQ 42 goto p11
if %j% LEQ 49 goto p12
if %j% LEQ 56 goto p13
if %j% LEQ 64 goto p14
if %j% LEQ 72 goto p15
if %j% LEQ 81 goto p16
if %j% LEQ 90 goto p17
if %j% LEQ 100 goto p18

goto j

:p1
if %o% EQU 1 set d=%%~nxi & set u=45
set /a w=800
set /a h=1025/2-%u%
set m=2
goto print
:p2
if %o% EQU 1 set d=%%~nxi & set u=45
set /a w=800/2
set /a h=1025/2-%u%
set m=3
goto print
:p3
if %o% EQU 1 set d=%%~nxi & set u=45
set /a w=800/2
set /a h=1025/3-%u%
set m=3
goto print
:p4
if %o% EQU 1 set d=%%~nxi & set u=30
set /a w=800/3
set /a h=1025/3-%u%
set m=4
goto print
:p5
if %o% EQU 1 set d=%%~nxi & set u=30
set /a w=800/3
set /a h=1025/4-%u%
set m=4
goto print
:p6
if %o% EQU 1 set d=%%~nxi & set u=30
set /a w=800/4
set /a h=1025/4-%u%
set m=5
goto print
:p7
if %o% EQU 1 set d=%%~nxi & set u=25
set /a w=800/4
set /a h=1025/5-%u%
set m=5
goto print
:p8
if %o% EQU 1 set d=%%~nxi & set u=30
set /a w=800/5
set /a h=1025/5-%u%
set m=6
goto print
:p9
if %o% EQU 1 set d=%%~nxi & set u=25
set /a w=800/5
set /a h=1025/6-%u%
set m=6
goto print

:print
echo ^<table cellspacing=2^> >>"c:\zz.html"
for %%i in (%*) do (
set /a "p=p+1"
set "bo="
if !p! == !m! (set "p=1" & set "bo=<tr>")
echo !bo!^<td^>^<img width=%w% height=%h% src=%%i^>^<br^>%d%>>"c:\zz.html" )
start c:\windows\explorer.exe "c:\zz.html" &exit

Put this code in %userprofile% SENDTO folder , right click several images >Sent To and Print.cmd, script writing upto 300 is mess i need to simplyfy/find common , layout it goes like this 1/1,1/2,2/2,2/3,3/3,3/4,4/4,4-5,5/5..etc upto300 that divide 1200x800pix equally

s1i2v3a
  • 29
  • 8
  • I have no idea what you're asking. What is this "300" you keep mentioning? – SomethingDark Aug 07 '15 at 06:08
  • @SomethingDark .to print 300pic or more per page. the script automate the layout __300 means 15col & 20row layout. – s1i2v3a Aug 07 '15 at 08:53
  • Maybe [this answer](http://stackoverflow.com/a/27652107/1683264) will give you some ideas? – rojo Aug 07 '15 at 10:18
  • take a look at this - https://msdn.microsoft.com/en-us/library/windows/desktop/ms630819(v=vs.85).aspx - no need of third party tools but you'll need a little jscript or vbscript coding. – npocmaka Aug 07 '15 at 11:25
  • @rojo tht is ma qstn last year. the answer is specific, but I WANNA AUTOMATE this – s1i2v3a Aug 07 '15 at 12:56

1 Answers1

1

Download Link (In Windows Binary Release Section)

convert -crop +100+10 in.jpg out.jpg
crops 100 pixels off the left border, 10 pixels from the top.

convert -crop -100+0 in.jpg out.jpg
crops 100 pixels off the right, 0 pixels from the top.

Checkout imagemagick command line processing website for more infomation: http://www.imagemagick.org/script/command-line-processing.php

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Happy Face
  • 1,061
  • 7
  • 18
  • @s1i2v3a That's impossible! There's no such command to do that! All commands : https://technet.microsoft.com/en-us/library/bb490890.aspx – Happy Face Aug 07 '15 at 05:37
  • yo DF.. explorer'll resize and arrange the pics.. the question is hw to simplify script.. RUN it and answer – s1i2v3a Aug 07 '15 at 05:41