Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Resizing proportionally

62 views
Skip to first unread message

Lars Forslin

unread,
Nov 19, 2003, 4:27:18 AM11/19/03
to corel.graphic_apps.draw-script

There is a script by James Aswell in circulation that is supposed to resize
images proportionally to a certain width or height, whichever comes first.
This script has been published here by Bill W, but not on James own site
(www.antipoetics.com). However, it never worked for me, I always get the
wrong proportions.

My question: is there a reliable resizing script that does the same thing? I
saw Jonathan Little posted something on nov. 16, but that wasn't a complete
script. Would you have the kindness of posting it complete?

Best regards,

--
Lars Forslin

http://www.connect.to/forslin

"Doing time on earth"

**************************

Alex Vakulenko

unread,
Nov 19, 2003, 9:42:41 AM11/19/03
to corel.graphic_apps.draw-script

Lars,

If you need this for Photo-Paint, you can get the following script:
http://www.oberonplace.com/draw/paintscripts/imgconvertsh.htm

You can peek in the source code to figure out how this is done, if you want
to implement the resampling in your own program...

Alex

"Lars Forslin" <lars.forslin...@home.se> wrote in message
news:3fbb32ad_1@cnews...

Jonathan Little

unread,
Nov 19, 2003, 3:41:19 PM11/19/03
to corel.graphic_apps.draw-script

>
> I
>
>>saw Jonathan Little posted something on nov. 16, but that wasn't a
>
> complete
>
>>script. Would you have the kindness of posting it complete?


Lars:

Sorry, the script fragment in that post was only a piece of a much
larger script used to automate the process of making thumbnails for my
online gallery and had parts specific to my needs but not really
applicable for others. Here is a script as a whole function that is more
generalized that will do what you ask. You may have to tweak some to
suit your version of PP.

'==================================================================================
REM Resample Image To MAX Dimension
REM Jonathan N. Little 11/19/03

DIM msg AS STRING
DIM orientation AS INTEGER
DIM newH AS LONG, h AS LONG
DIM newW AS LONG, w AS LONG
DIM xOffset AS LONG
DIM yOffset AS LONG
DIM max AS LONG
DIM fn AS STRING

CONST DPI = 75 'Change as needed
CONST PORTRAIT AS INTEGER = 0
CONST LANDSCAPE AS INTEGER = 1
CONST SQUARE AS INTEGER = 2

WITHOBJECT "CorelPhotoPaint.Automation.11" '<- Ajust for your version
REM Get current values
fn = .GetDocumentName()
w =.GetDocumentWidth()
h =.GetDocumentHeight()

msg = fn & " is currently " & w & " x " & h & ", enter max size in pixels"

max = CLNG(INPUTBOX(msg))

IF h > w THEN 'then set newH to max and derive newW
orientation = PORTRAIT
newH = max
newW = CLng((max/h) * w)
ELSEIF h < w then
orientation = LANDSCAPE
newW = max
newH = CLng((max/w) * h)
ELSE
orientation = SQUARE
newW = max
newH = max
ENDIF

.SetDocumentInfo w, h
.ImageResample newW, newH, DPI, DPI, TRUE

END WITHOBJECT

msg = fn & " has been resampled to " & newW & " x " & newH & " at " &
DPI & " DPI"

MESSAGEBOX msg, "Resample Tp Max",0
'==================================================================================


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Lars Forslin

unread,
Nov 19, 2003, 6:18:06 PM11/19/03
to corel.graphic_apps.draw-script

Thanks Alex, I found that one right after posting this. Worked like a
breeze. Very nice. Thanks again.
Lars


"Alex Vakulenko" <alexv?@?vakcer?DOT?com> skrev i meddelandet
news:3fbb7c98$1_1@cnews...

Lars Forslin

unread,
Nov 19, 2003, 6:51:01 PM11/19/03
to corel.graphic_apps.draw-script

Thanks Jonathan for providing the script. Unfortunately I didn't get your
script to work. I get an error when trying to run it either from the script
docker or from the Tools/Run Corel script menu. I learnt from James that it
really makes a difference where you run the scripts.
Anyway, I wonder about this row:

msg = fn & " is currently " & w & " x " & h & ", enter max size in pixels"
I suppose you change this into something like this:
msg = fn & " is currently " 200 " x " 300 ", enter max size in pixels"
Or like this:
msg = fn & " is currently " 200 " x " 300 ", 'enter max size in pixels"
Or something like that, but I still get error message.

Sorry, I'm not much of a programmer... Are there other rows that needs to be
tweaked too?

Regards,
Lars

"Jonathan Little" <lws...@centralva.net> skrev i meddelandet
news:3fbbd0ce_1@cnews...

Jonathan Little

unread,
Nov 19, 2003, 8:49:10 PM11/19/03
to corel.graphic_apps.draw-script

Lars:

The problem is the forced wrapping of the news group.

I have split the long lines up and built the msg string bay appending it
to stop spliting the string in this news group. This does work cut'n paste

'=========================================================================


REM Resample Image To MAX Dimension
REM Jonathan N. Little 11/19/03

DIM msg AS STRING
DIM orientation AS INTEGER
DIM newH AS LONG, h AS LONG
DIM newW AS LONG, w AS LONG
DIM xOffset AS LONG
DIM yOffset AS LONG
DIM max AS LONG
DIM fn AS STRING

CONST DPI = 75 'Change as needed
CONST PORTRAIT AS INTEGER = 0
CONST LANDSCAPE AS INTEGER = 1
CONST SQUARE AS INTEGER = 2

WITHOBJECT "CorelPhotoPaint.Automation.11" '<- Ajust for your version
REM Get current values
fn = .GetDocumentName()
w =.GetDocumentWidth()
h =.GetDocumentHeight()

' Append 'cuz the forced line wrap in news group


msg = fn & " is currently " & w & " x " & h

msg = msg & ", enter max size in pixels"



max = CLNG(INPUTBOX(msg))

IF h > w THEN 'then set newH to max and derive newW
orientation = PORTRAIT
newH = max
newW = CLng((max/h) * w)
ELSEIF h < w then
orientation = LANDSCAPE
newW = max
newH = CLng((max/w) * h)
ELSE
orientation = SQUARE
newW = max
newH = max
ENDIF

.SetDocumentInfo w, h
.ImageResample newW, newH, DPI, DPI, TRUE
END WITHOBJECT

' Append 'cuz the forced line wrap in news group


msg = fn & " has been resampled to " & newW & " x " & newH & " at "

msg = msg & DPI & " DPI"

MESSAGEBOX msg, "Resample Tp Max",0

'=========================================================================


Bill W

unread,
Nov 20, 2003, 11:18:20 AM11/20/03
to corel.graphic_apps.draw-script

Jonathan Little wrote:

> Lars:
>
> The problem is the forced wrapping of the news group.

Does not wrap here :-)

It's a setting in "your" software.

I believe it's under Edit/Preference in Mozillia and Netscape.
Although 75 characters should fit most default settings in and out.
I have nine set to 150 characters (incoming and outgoing)
so I can see a long URL address when posted without
having to copy it to the clipboard.

Kind regards,
Bill W

--
Corel PHOTO-PAINT Scripts by James Aswell
http://www.antipoetics.com/stuff/progs/index.html

Lars Forslin

unread,
Nov 23, 2003, 6:57:12 AM11/23/03
to corel.graphic_apps.draw-script

Thanks a lot Jonathan. Works fine now.
/Lars

"Jonathan Little" <lws...@centralva.net> skrev i meddelandet

news:3fbc18dc$1_3@cnews...

Jonathan Little

unread,
Nov 23, 2003, 9:21:54 AM11/23/03
to corel.graphic_apps.draw-script

Lars Forslin wrote:
> Thanks a lot Jonathan. Works fine now.
> /Lars

Yes, the newsgoups setting on my MOZ wrapped the two prompt string that
should have been all on one line, each that cause the trouble.

0 new messages