Photo Processing in Rev

Sivakatirswami katir at hindu.org
Tue May 29 16:16:05 EDT 2007


I changed the subject thread on this one, since, while ImageMagick
looks very powerful, it would require installation on any machine
using these tools, where as the goal is portability, and a standalone
REv stack becomes a virtual "droplet" requiring no additional engines.
(ImageReady was installed by default in most machines in our shop...
but not any more....) and Wilhelm Sanke's  tools seem to be
constrained to specific images sizes (I have to be able to
handle any incoming rect)

So, I proceeded with a really basic handler
  for simple scaling and rotation. Which is all we really need.
a lean machine -- nothing artsy or complicated....

It works quite well.
I wasn't sure if imagedata was dependent on display
but just took a shot at it with lock screen and it still
works and really speeds it up a lot. I know lots
of you are already doing this, but perhaps some lurkers
might like my "baby xTalk," approach.
if there was some interest in a "really, really simple
photo processor" I will put my stack on line...
I also have rotation and previewing....

see framework and script below. Quality was
excellent, though a little unsharp mask always
helps to punch out these small jpegs.. and we don't get
that here...(if anyone knows how to add that as a discreet
filter to any rect...please jump in!)

Caveat: to my surprise, the resulting file on disk
retains the resource fork, which includes a thumbnail
of the image and I suspect some IDCS camera data..
i.e the file size of the result was 72K... OK so I upload
this with my ftp client to our linux web server
(guaranteed to strip the resource fork) and it drops
to 20 K.  So we're carrying 52K of metadata across
the processing. Maybe some might want that... I don't.

I could have sworn in my tests yesterday that the
resource fork was being stripped but it's not today.

any ideas on how to drop that baggage from
the export?

==========

UI has a field with file names (inserted with other butten tools)
  and two images "CurrentImage" and "NewImage"

this particular application for our web blog wants photos to be 360 wide
by * tall...

I have this button (width value is hard coded now, but
  later i will make it a pref setting in the UI and
pass it down as a param)

global gCurrentFolder

on mouseUp
   lock screen
   put fld "fileList" into tImages
   repeat for each line tImage in tImages
     put tImage into fld "CurrentImage"
     put (gCurrentFolder& tImage ) into tNextImage
     set the filename of image "currentImage" to tNextImage
     scaleImageToWidth 360, tImage
   end repeat
   beep
end mouseUp

and this in the stack script

on scaleImageToWidth pWidth, tImage
   set the resizeQuality of img "currentImage" to "best"
   put the width of img "CurrentImage" into tOrigWidth
   put the height of img "CurrentImage" into tOrigHeight
   set the width of img "CurrentImage" to pWidth
   set the height of img "CurrentImage" to ((tOrigHeight*pWidth)/tOrigWidth)

# imagedata only transfers across two equal rects:
   set the rect of img "newImage" to the rect of  img "CurrentImage"

     # just to see them side by side:
   set the left of image "newImage" to the (the right of image
"CurrentImage" + 100)
   set the imagedata of img "newImage" to the imageData of img
"CurrentImage"

    set the JPEGQuality to (fld "jpegSetting") # set to 75
    export image "newImage" to file gCurrentFolder & tImage as JPEG

# surpise! resource fork intact in resulting image?

end scaleImageToWidth


its a start....

Sivakatirswami
www.himalayanacademy.com

btw... someone was wondering what happened to Dan Schafer? I suspect he
fearlessly put
on browser scuba gear (and you need all kinds of torches, welding
eqiupment, etc.
and special rigging, safety gear etc. just to get a tinsy bit of content
out the door...)
and dove into an ocean of AJAX, Java script and web apps. (I'm seeing if
this might spark a response from our old friend and once strong Rev
Advocate and Mentor)




More information about the use-livecode mailing list