hi michael,

this might help you out (just add a repeat loop thru all members..)



---
on imgToFile( aImg, aStrFileName, aPl )
 [EMAIL PROTECTED]        0 or err code
 [EMAIL PROTECTED]         image|bmp member|window,
 --                optional string filename(default=dialog),
 --                optional proplist with any of
 --                 #fileType: #jpg|#png|#bmp  (default=#jpg)
 --                 #quality:  0..100          (default=100)
[EMAIL PROTECTED] takes a image and saves it to png file. takes filename from fileSaveAs dialog
 [EMAIL PROTECTED]         dialogTools
 [EMAIL PROTECTED]        xtra "sharpExport"
 [EMAIL PROTECTED]            put imgToFile( the stage )
 --                -- 0
 --  0 - success
 -- -1 - destination file can not be written
 -- -2 - out of memory
 -- -3 - wrong number of args
 -- -4 - bad parameter
 -- -5 - castmember not found
 -- -6 - castmember media not found
 -- -7 - castmember is not a bitmap
 -- -8 - unsupported bitdepth (JPEG support is 8 bits or higher)
 -- -9 - JPEG compression failed (internal error with JPEG library
 -- -10 - PNG compression failed (internal error with PNG library

 -- PARAMS
 if NOT(aPl.ilk=#proplist) then aPl = [:]

 if voidP(aPl[#fileType]) then aPl[#fileType] = #jpg
else if NOT([#jpg,#png,#bmp].getPos(aPl.fileType)) then aPl[#fileType] = #jpg

 if aPl.fileType=#jpg then
   if voidP(aPl[#quality]) then aPl[#quality] = 100
   else aPl.quality = min(max(1,aPl.quality),100)
 end if

 case aImg.ilk of
#image:
     -- IMAGE
     tMem = new(#bitmap)
     tMem.image = aImg
     _erase = TRUE
#member:
     -- MEMBER:
     tMem = aImg
#window:
     -- WIN
     tMem = new(#bitmap)
     tMem.image = aImg.image
     _erase = TRUE
otherwise:
     -- ERR PARAM
     tMem = aImg
end case

 -- FILE PATH
if NOT(stringP(aStrFileName)) then aStrFileName = dlgFileSaveAs( [#filename:"*."&string(aPl.fileType), #instruction:"please enter a file name."] )

 -- SAVE
 case aPl.fileType of
#jpg: tErr = xtra("sharpExport").new().exportJpg( tMem, aStrFileName, aPl.quality ) #png: tErr = xtra("sharpExport").new().exportPng( tMem, aStrFileName ) #bmp: tErr = xtra("sharpExport").new().exportBmp( tMem, aStrFileName ) end case

 if _erase=TRUE then erase tMem

 return tErr
end imgToFile
---


cu,
benjamin ;)




Michael Nadel schrieb:
If I have a cast of 1000 bmps pictures and I want to save each cast
member as a jpg or gif (or even as bmps, if I have to) onto my computer
somewhere as individual files, Is there a way? Can anyone help me with
the code to do this?

Michael Nadel
MediArt.Corp
"Creativity is more powerful than knowledge" -- Albert Einstein
***********************************************************************
Tel: (972-2) 5807-454
Email: [EMAIL PROTECTED]
Web: http://www.mediarthome.com

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]




--
Benjamin Albrecht

mail:   [EMAIL PROTECTED]
web:    www.benjaminalbrecht.com
mobile: +49 - 177 - 38 111 68
phone:  +49 - 4131 - 246 271

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to