copying a bit of the screen

BlitzPlus Forums/BlitzPlus Programming/copying a bit of the screen

julianbury(Posted 2008) [#1]
Hiya Coders

I use BlitzPlus as, among other things, a scripting utility.
I make routines to create webpages ind index files - all sorts of stuff.

One indispensible script is for resizing images for web content.
My method for this is to show the image on screen at the size I want and then capture that screen area. I process directories of images at a time.

My problem is that the resized images can only be saved by BlitzPlus as .bmp files. I need them to be .jpg files.

Can anyone tell me how to save the shots as .jpg file?

Thank you for your kind attention (-_-)

And example script:

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; ResizeByWidth.bp
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Global csd
Global file$, bmp$
Global pic, ok, x#, d#
Global sorc$, dest$
Global xres=GadgetWidth(Desktop())
Global yres=GadgetHeight(Desktop())

Graphics xres, yres,16,0
SetBuffer BackBuffer()

sorc$="big/"
dest$="small/"

csd=ReadDir(sorc$)
Repeat
file$=NextFile$(csd)
If Len(file$)>5
bmp$=Left$(file$,Len(file$)-3)+"bmp"
pic=LoadImage(sorc$+file$)
x# = ImageWidth(pic)
d# = 150.0/x#
ScaleImage pic, d#, d#
Cls
DrawImage pic, 0,0
Flip
Delay 200
ok=SaveImage (pic,dest$+bmp$)
FreeImage(pic)
EndIf
Until file$=""

End


GaryV(Posted 2008) [#2]
This thread should help:

http://blitzmax.com/Community/posts.php?topic=71437#798850

If you get Freeimage and look for the declares in the code archive, you should be set.