home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Spanish Scene 4
/
SpanishScene4.iso
/
Programas
/
EsteveBoix_Ind
/
tablePlugv12.lha
/
tablePlug12
/
rx
/
tvp_dt.tpx
< prev
next >
Wrap
Text File
|
1999-10-11
|
2KB
|
79 lines
/*
tvp_dt.tpx v1.0 © 1999 Esteve Boix
This module uses the tool (included in tablePlug)
"tp_dtc" to load the image and
save it in standard IFF24 bit format. This image
is then loaded into TVPaint, it scales it down
and saves it as JPEG file.
This way, any image file recognized by datatypes is
loaded without problems.
Tested only on the freeware version 3.59 of TVPaint.
Args: SIZEX SIZEY JPEG_COMPRESSION
Where:
SIZEX, SIZEY Size in pixels of the thumbnail
JPEG_COMPRESSION Well...
*/
multiview="sys:utilities/multiview" /* Modify if necessary */
options results
parse arg maxsizex maxsizey compression infile outfile
infile=strip(infile)
outfile=strip(outfile)
/* Load the image and save it with tp_dtc */
address command
'tableplug:tools/tp_dtc >nil: <nil: '||infile||' ram:tP_temp_image.iff'
address 'rexx_TVPaint'
'tv_LoadProject ram:tP_temp_image.iff'
if rc~=0 then exit
/* Now delete the iff image created by tp_dtc */
address command
'delete >nil: <nil: ram:tP_temp_image.iff'
'delete >nil: <nil: '||outfile /* Delete a possible old thumbnail.... TVPaint doesn't like it */
address 'rexx_TVPaint'
/* Obtain info about the image */
tv_getwidth
x = result
tv_getheight
y = result
/* ...and calculate the thumbnail resolution */
comp=trunc((maxsizex/x)*y)
if comp<=maxsizey then do
tv_resizepage maxsizex comp 2 /* Discovered after some attempts... */
end
else do
comp2=trunc((maxsizey/y)*x)
tv_resizepage comp2 maxsizey 2 /* Discovered after some attempts... */
end
/* And save the image */
address 'rexx_TVPaint'
tv_savemode jpeg compression
tv_savedisplay outfile
address command
'delete >nil: <nil: '||outfile||'.info' /* Delete the info file created by TVPaint */