WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Batch graphics conversions

Keywords:   batch conversion

Question:

Is anybody here in WinBatch land using WinBatch to automate any graphics file conversions? I went out to http://www.winfiles.com and searched for graphics conversion tools. I did not find anything that really suited my needs w/respect to being fully automated.

I'm scanning in my family photo albums, which is a manual process. Much to my chagrin, I discovered that my scanning software only returns bitmap files (.BMP) with 24-bit color. I want to convert these to .JPG format, with baseline image processing (as opposed to progressive processing) and highest quality (e.g. lowest compression) on the .JPG file that gets produced. The .JPG format is more efficient than .BMP format even when the image quality is set to its highest possible value. What I want to do is to simply reduce the overall disk space used by the image files.

I currently have 3 x 1.0GB Jaz disks filled with images, which equates to about 150 B&W and color photographs. This is just a single photo album and there are about 15 more of them that need to be scanned. I want to batch process all of these from .BMP to .JPG format. Once the image conversion is done they get entered into a photo catalog database and then burned onto a CD-ROM.

I currently have the Adobe PhotoDeluxe v2.0 and Adobe PhotoShop v4.0 LE software packages that came bundled with my scanner and digital camera. I cannot find any information at http://www.deja.com or http://www.adobe.com regarding any OLE automation features in these products. Each of these products has nice fuctions for doing an automatic image quality enhancement and saving to a different format. I could take some time to use the Control Manager extender to automate PhotoDeluxe, but I'm really hoping that OLE automation support is available in a decent graphics editing package. Does anybody know about such a product with OLE automation features?

Answer:

  1. I use LviewPro for a lot of graphic tasks, which I use in the example below. You can get a copy of Lview from:
    Lview Product Page
    

  2. You could save the Bitmap and then use the command line utility ImageMagick to convert it. See http://www.imagemagick.org/ for details. Basically you would only need to add 1 line to your script!

  3. There's a UDF in the database to convert BMPs to JPGs. Search for JPG and UDF.

  4. I wrote a script to mass convert GIF file to JPG.

    See as follows...

list=FileItemize("*.gif")
count=ItemCount(list,@tab)
Run("C:\Apps\lviewpro\LVIEWPRO.EXE","")
Timedelay(2)
lv=WinIDGet(WinGetActive())
for xx=1 to count
   giffile=ItemExtract(xx,list,@tab)
   clipput(giffile)
   jpgfile=strcat(FileRoot(giffile),".jpg")
   if FileExist(jpgfile) then continue
   SendMenusto(lv,"FileOpen")
   SendKey("^v~")
   wa=0
   wx2=0
   while wa<20
      TimeDelay(1)
      wx2=wx2+1
      if wx2>10 then break
      wa=strlen(WinGetActive())
   endwhile
   Errormode(@off)
   LastError()
   :woop
   SendMenusTo(lv,"FileSaveAs")
   if lasterror()!=0 then goto woop
   Errormode(@cancel)
   if FileExist(jpgfile) then continue
   Clipput(jpgfile)
   SendKey("^v~")
   while Filesize(jpgfile)==0
      TimeDelay(1)
   endwhile
  ; break
next

Another Answer:

Paint Shop Pro is what I use, its available from www.jasc.com - just to let you compare - last year for my parents' anniversary I broke into their house and stole ALL their photo albums and pictures. I spent 2 weeks scanning them in. I used .jpg format. 2700 pictures as .jpg's took about 250MB on ONE CD that I burned for them. You definitely want to convert those pics. Try to find someone that has a Kodak digital camera - their software lets you open up a "slide table" of pics and then do a "save all" to any format you like. That would do it too.

And a handy utility to manage your JPGs:

And if you have one of those floppy dohickeys to copy file from the camera to the computer...see...

WBT File to Display JPGs on an HTML Layout Page:

AddExtender("WWHTM34I.DLL")

; This is the Camera Copier

BaseDirectory=DirGet()
UseHtmlFile=strcat(BaseDirectory,"jpg.html")


tempfile=Environment("TEMP")
if strsub(tempfile,strlen(tempfile),1)!="\" then tempfile=strcat(tempfile,"\")
tempfile=strcat(tempfile,"jpegtemp.html")
WinTitle("","Camera Copier")


srcfolder="A:\imolym\"
destfolder=Strcat(BaseDirectory,"Pictures\")
if !DirExist(destfolder) then DirMake(destfolder)

x=0
while x==0
   ErrorMode(@off)
   x=LogDisk("A:")
   ErrorMode(@CANCEL)
   if x==1 then break
   Pause("A:","Not ready.  Insert disk")
endwhile
DirChange(basedirectory)

srclist=FileItemize("%srcfolder%*.jpg")
srccount=ItemCount(srclist,@TAB)

realcount=srccount
if ((srccount mod 2) == 1)
   srclist=strcat(srclist,@tab,"NONE")
   srccount=srccount+1
endif

linecount=srccount / 2



bb=BinaryAlloc(10000)





                                       

    gosub  dohtmlfixup
    ;debug(1)
    url=hBrowse(2,tempfile,3)
    if url=="" then exit
    button=hGetVarValue("button","xxx")
    if button=="Cancel" then exit
    if button=="Ok"  
       newlist=""
       for xx = 1 to linecount
         indexplusone=(xx*2)
         index=indexplusone-1
         if xx!=1 then newlist=strcat(newlist,@tab)
         TA=hGetVarValue("index%index%","NONE")
         TB=hGetVarValue("index%indexplusone%","NONE")
         newlist=strcat(newlist,TA,@TAB,TB)
       next


       for xx=1 to realcount
          origname=ItemExtract(xx,srclist,@tab)
          newname=ItemExtract(xx,newlist,@tab)

          if newname=="NONE"
               ;Message("Skipping #%xx%",origname)
               continue
          endif

          srcfile=strcat(srcfolder,origname)
          destfile=strcat(destfolder,newname,".jpg")
          rslt=FileCopy("%srcfile%","%destfile%",1)
          
          
       next

    endif

    Message("All","Doned")



exit  ; bye






:DoHtmlFixup
;debug(1)
BinaryEODSet(bb,0)
BinaryRead(bb,UseHtmlFile)

Structure=BinaryTagInit(bb,"{{","}}")

while 1
    structure=BinaryTagFind(structure)
    if structure=="" then break
    wbdata=strtrim(BinaryTagExtr(structure,0))
    wbcmd=strlower(ItemExtract(1,wbdata," "))
    wbparams=strtrim(strsub(wbdata,strlen(wbcmd)+1,-1))
    HtmlValue="???????"
    gosub %wbcmd% ; 
    structure=BinaryTagRepl(structure,HtmlValue)
endwhile


BinaryWrite(bb,tempfile)
return

:Value
   HtmlValue=%wbparams%
   return

:INSERTPICTURES
HtmlValue=""

for xx = 1 to linecount
   indexplusone=(xx*2)
   index=indexplusone-1
   jpga=ItemExtract(index,srclist,@tab)
   jpgb=ItemExtract(indexplusone,srclist,@tab)
   fulljpga=strcat(srcfolder,jpga)
   fulljpgb=strcat(srcfolder,jpgb)
   temp=StrReplace(wbparams,"XXXJPGA",FileRoot(jpga))
   temp=StrReplace(temp,"XXXJPGB",FileRoot(jpgb))
   temp=StrReplace(temp,"XXXFULLJPGA",fulljpga)
   temp=StrReplace(temp,"XXXFULLJPGB",fulljpgb)
   temp=StrReplace(temp,"XXXTA","index%index%")
   temp=StrReplace(temp,"XXXTB","index%indexplusone%")
   htmlvalue=strcat(htmlvalue,temp)
next

return

And the HTML file to go with the WBT:

<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>JPG Renamer</title>
</head>

<body bgcolor="#FFFFFF">

<h1 align="center">JPG Renamer</h1>
<div align="center"><center>

<table border="0">
    <tr>
        <td><p align="center">From:</p>
        </td>
        <td><p align="center">{{VALUE SRCFOLDER}}</p>
        </td>
    </tr>
    <tr>
        <td><p align="center">To:</p>
        </td>
        <td><p align="center">{{VALUE DESTFOLDER}}</p>
        </td>
    </tr>
</table>
</center></div>

<p> </p>
<div align="center"><center>
<form method="POST" action="ignored">

<table border="0" width="95%">
{{INSERTPICTURES <!--new pair-->
    <tr>
        <td valign="top"><img

        src="XXXFULLJPGA"
        align="middle" width="320" height="240"></td>
        <td valign="top"><img src="XXXFULLJPGB"
        align="middle" width="320" height="240"></td>
    </tr>
    <tr>
        <td align="center">

            <p>
            <b>XXXJPGA</b>
            <br><input type="text" size="35" name="XXXTA" value=""></p>
        </td>
        <td align="center">
            <p>
            <b>XXXJPGB</b>
            <br><input type="text" size="35" name="XXXTB" value=""></p>
        </td>
    </tr>
}}
</table>
<p><INPUT TYPE="SUBMIT" VALUE="Ok" name="button">
   <INPUT TYPE="SUBMIT" VALUE="Cancel" name="button">

</form>
</center></div>
</body>
</html>

Article ID:   W14376
Filename:   Batch Graphics Conversion.txt
File Created: 2001:12:04:15:06:32
Last Updated: 2001:12:04:15:06:32