Re: applescript-users digest, Vol 3 #185 - 12 msgs
Re: applescript-users digest, Vol 3 #185 - 12 msgs
- Subject: Re: applescript-users digest, Vol 3 #185 - 12 msgs
- From: Brian <email@hidden>
- Date: Thu, 28 Feb 2002 20:18:41 -0500
on 2/26/02 6:29 PM, Brennan at email@hidden wrote:
thanks for the tips, I'll be testing them shortly.
FYI my high ascii character was 'not equal to' < option = >
which with the addition of a display dialog "I'm making it square" command
does in fact pop up the dialog but the 1 pixel difference persists.
brian
>
On 24/2/02 at 22:16, email@hidden wrote:
>
>
> Message: 8
>
> Date: Sun, 24 Feb 2002 16:08:54 -0500
>
> Subject: making rectangular images square
>
> From: Brian <email@hidden>
>
> To: <email@hidden>
>
>
>
> I need to write a script that will convert folders of either vertical or
>
> horizontal images to squares. Below is my first pass at writing the script.
>
> Environment is:
>
> Mac OS 9.x
>
> Applescript 1.4.3
>
> Graphic converter 3.9.1
>
>
>
> The script works pretty well, but still occasionally misses creating a
>
> square output file. What I receive instead is a file whose dimensions
>
> differ by exactly one pixel. I'm pretty sure the reason for this is my
>
> blunt instrument approach of taking the width/height and dividing 2, setting
>
> that value to a variable and padding by that value on both the left and
>
> right or top and bottom to center the original image.
>
>
No, that's not the reason. It's because you're only adjusting images whose
>
width is greater than the height (or is it the other way? I can't tell because
>
of the gremlin in your code - see below).
>
>
>
>
> My attempts to evaluate whether the width height are an odd integer have not
>
> been successful, however and any guidance would be greatly appreciated.
>
>
Very simple;
>
>
set widthIsOdd to ((theWidth mod 2)=1)
>
set HeightIsOdd to ((theHeight mod 2)=1)
>
>
> If, alternatively there's a better way to build this mousetrap I'd be
>
> curious to explore those options as well.
>
>
I'd use akua sweets for this because you don't need to open GC at all. It's
>
much faster.
>
>
I have done for something similar; getting images to fit in a maximum width
>
for a web page. The only problem was that akua (i.e. Quicktime) can't export
>
GIFs.
>
>
> set the creator type of this_item to "GKON" -- so it opens with GC
>
>
This is not necessary. You're going to tell GC to open it anyway, so the
>
creator is moot.
>
>
> -- trying to force image to square with this next bit unsuccessfully
>
> set xy to image dimension of window 1
>
> set thenewWidth to item 1 of xy
>
> set thenewHeight to item 2 of xy
>
> if thenewHeight thenewWidth then
>
> set thenewHeight to thenewWidth
>
> set image dimension of window 1 to {thenewWidth, thenewHeight}
>
> end if
>
> --end of my failed coercion to square
>
>
We got a high ascii gremlin in there so I don't know if you meant >= or <=.
>
Anyway, you're making the test one way but not the other.
>
>
Don't forget to add an 'else' clause.
>
>
if thenewHeight >= thenewWidth then
>
set thenewHeight to thenewWidth
>
set image dimension of window 1 to {thenewWidth, thenewHeight}
>
else
>
set thenewWidth to thenewHeight
>
set image dimension of window 1 to {thenewWidth, thenewHeight}
>
end if
>
>
>
Brennan
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.