use to-image outside of the ui ;-)

here is a complete app which has external path specs, so that you don't have to fiddle 
in the code to adapt it to different paths

just change the apps and it will do its magic on the directorie's content.

of course, the directories should be different, otherwise you'll end up with both 
thumbnails and source image in the dir, and running the application will duplicate 
your thumbnails with interesting filenames ;-)



;----------------------------------------------

rebol []

in-dir: %/d/imgsrc/
out-dir: %/d/imgdest/

imgs: read in-dir

foreach file imgs [
        filename: replace copy file %.jpg %_thumbnail.png
        
        in-path: append copy in-dir file
        out-path: append copy out-dir filename
        
        save/png out-path to-image layout [
                origin 0x0
                image 96x96 in-path
        ]
]

;--------------------------------------------------


-MAx
---
"You can either be part of the problem or part of the solution, but in the end, being 
part of the problem is much more fun."
 

> -----Original Message-----
> From: Steven White [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 22, 2004 4:39 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Creating thumbnails [view]
> 
> 
> 
> Good Day, Fountain of REBOL Knowledge,
> 
> The following script reads a big jpeg file and displays it on the
> screen as a 96x96 thumbnail.  When I hit the button, it saves 
> that image
> to disk as a 96x96 png thumbnail.  I mention this to show 
> that the idea
> can be done (as of course you know).
> _*_*_*
> 
> REBOL [
> ]
> 
> view layout [
>     thumbnail: image 96x96 %ships_1024.jpg
>     button 300x25 "save/png to-image thumbnail"     
>         [save/png %shipspng.png to-image thumbnail alert "done"]
> ]
> 
> _*__*_
> 
> Now, I want to do the same thing, but not in an interactive 
> manner, not
> with a screen.  I want a script that will automatically make 
> a bunch of
> thumbnails for a bunch of pictures without any human 
> intervention.  Can
> I do that?  
> 
> It seems I can't use the "image" key word outside of a layout.  If I
> use "to-image," I don't see how I can specify the size.  I know how to
> find all the files in a directory, and how to loop through them, etc,
> but I am missing that piece to read a jpeg file, turn it into a
> thumbnail, and write it, outside of a VIEW layout.  I have 
> looked at the
> cookbook example "HTML Thumbnail Photo Directory Maker," but that also
> uses an image within a layout.
> 
> Thank you.
> 
> 
> 
> Steven White
> City of Bloomington
> 1800 W Old Shakopee Rd
> Bloomington MN 55431-3096
> USA
> 952-563-4882 (voice)
> 952-563-4672 (fax)
> [EMAIL PROTECTED]
> -- 
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
> 
> 

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to