--- In [email protected], "swzoh" <[EMAIL PROTECTED]> wrote:
>
> This script converts image formats using only window's gdiplus.dll,
> among bmp, jpg, png, gif, tif. I think Bruce will implement this
> feature eventually into PP, then, stil32jp.dll wouldn't be needed
> anymore. Until then, may use the script instead. It uses only default
> settings for conversions. The usage is:
> 
> .ImageConv(sNameFr, sNameTo)
> 
> e.g., .ImageConv(?"...\test.jpg",?"...\test.png")

I updated it to include the saving options. In my test, meaningful
parameters only for JPEG and TIFF, none with BMP/GIF/PNG. Maybe due to
the image I used, but I don't really know. I only include one option
among four for JPEG, neglecting three options for TIFF as I don't use
it. It's the well-known quality parameter (0 ~ 100) for JPEG. As I
disabled it defaultly, may have to remove the comments to use it.


---------------- ImageConv.PowerPro ----------------------------------
args  sNameFr,sNameTo,xNameFr,xNameTo,sType,sExts
local pToken,pImage,pParam,pCLSID,nCodecs,nSize,ci,pi,si

dll.call("MultiByteToWideChar|ui ui s i s520 i",;;+
0,0,"sNameFr",-1,"xNameFr",260)
dll.call("MultiByteToWideChar|ui ui s i s520 i",;;+
0,0,"sNameTo",-1,"xNameTo",260)

sType=file.type(sNameTo)

si=dll.create_array(4,"i",1)
dll.call("gdiplus|GdiplusStartup|ui* a* ui","pToken",si,0)

dll.call("gdiplus|GdipLoadImageFromFile|s ui*","xNameFr","pImage")

dll.call("gdiplus|GdipGetImageEncodersSize|ui* ui*","nCodecs","nSize")
ci=dll.create_array(nSize/4+1,"i")
dll.call("gdiplus|GdipGetImageEncoders|ui ui a* b",nCodecs,nSize,ci)

for(local i=0;i<nCodecs;i++)
dll.call("WideCharToMultiByte|ui ui i i s i ui ui",;;+
0,0,ci[19*i+12],-1,"sExts",272,0,0)
if(index(sExts,sType))
break
endfor

dll.call("Cdecl|wsprintf|s s a* i","pCLSID","%d",ci)
pCLSID=pCLSID + 76*i

/* JPEG only
dll.call("gdiplus|GdipGetEncoderParameterListSize|ui ui ui*",;;+
pImage,pCLSID,"nSize")
pi=dll.create_array(nSize/4+1,"i")
dll.call("gdiplus|GdipGetEncoderParameterList|ui ui ui a* b",;;+
pImage,pCLSID,nSize,pi)

dll.call("Cdecl|wsprintf|s s a* i","pParam","%d",pi)
pParam=pParam + 28

local nQlty=100 ;; 0 ~ 100
pi[8]=1
pi[14]=4
pi[15]=pParam + 4 + 28
pi[16]=nQlty
*/

dll.call("gdiplus|GdipSaveImageToFile|ui s ui ui",;;+
pImage,"xNameTo",pCLSID,pParam)

dll.call("gdiplus|GdipDisposeImage|ui",pImage)
dll.call("gdiplus|GdiplusShutdown|ui",pToken)
quit
----------------------------------------------------------------------

Sean





Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/power-pro/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to