- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Scaled Image variables
Folks,
What is the best approach to open a single image, scale to multiple sizes and save each scale size to a variable?
Currently, I'm opening multiple images that are scaled and arranged so that the final picture will be copied and saved to Powerpoint. However, depending on types of images imported, two distinct arrangements are needed ("coltwin_1" and "coltwin_2" in attached script). One arrangement will have a different scale value.
As an example, I tried scaling an opened image and save as "col1" which would be in "coltwin_1. The second scaled variable is "col1x" used in "coltwin_2" arrangement. However when using col1x = col1 << Scale(1.5), the scale for col1 propagated through both layouts.
What is the best and cleanest approach to this issue?
Many thanks,
Neil
col1 = Open(SD1 || samplename2 || "_a1_16col_filt.jpg", jpg);
col1 << Scale(.16);
col1x = col1 << Scale(1.5);
col2 = Open(SD1 || samplename2 || "_a2_16col_filt.jpg", jpg);
col2 << Scale(.16);
col2x = col2 << Scale(1.5);
coltwin_1 = Expr( // For surface orientation
V List Box(
H List Box(
sem1,
col1 ,
LT1 ,
),
sp1 = Spacer Box( size(0, 50)),
H List Box(
sem2,
col2,
LT2,
),
sp2 = Spacer Box( size(0, 50)),
H List Box(
sem3,
col3,
LT3
)
)
);
coltwin_2 = Expr( // For Xsec orientation
V List Box(
H List Box(sem1,
V Splitter Box(
col1x,
LT1x
),
),
sp1 = Spacer Box( size(0, 50)),
H List Box(sem2,
V Splitter Box(
col2x,
LT2x
),
),
sp2 = Spacer Box( size(0, 50)),
H List Box(sem3,
V Splitter Box(
col3x,
LT3x
),
)
)
);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scaled Image variables
Seems like you will have to create new image like col1x = New Image(col1);
Names Default To Here(1);
img = Open("$SAMPLE_IMAGES/tile.jpg", jpg);
Show(img << get size());
img << scale(0.5);
Show(img << get size());
img2 = img;
img2 << Scale(2);
Show(img << get size(), img2 << get size());
img3 = New Image(img);
img3 << scale(3);
Show(img << get size(), img3 << get size, img2 << get size());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scaled Image variables
Definitely not sure if this is a best or even good approach but... I think using << Scale() won't return return new image and will just update the old one. I think easiest solution would be to create a copy of col1 to colx and then scale that
col1 = Open(SD1 || samplename2 || "_a1_16col_filt.jpg", jpg);
col1 << Scale(.16);
col1x = col1;
col1x << Scale(1.5);
This should get you the original image first scaled to 0.16 and then a new image which will be the original image first scaled to 0.16 and then to 1.5 (thou it might be better to create copy before the 0.16 scaling and then scale to correct value).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scaled Image variables
Many thanks for the input.
I tried the initial approach you suggested, but still got a situation where the secondary scaling factor still affected the initial col1 variable.. I attached a graphic showing what happened before / after commenting last line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scaled Image variables
Seems like you will have to create new image like col1x = New Image(col1);
Names Default To Here(1);
img = Open("$SAMPLE_IMAGES/tile.jpg", jpg);
Show(img << get size());
img << scale(0.5);
Show(img << get size());
img2 = img;
img2 << Scale(2);
Show(img << get size(), img2 << get size());
img3 = New Image(img);
img3 << scale(3);
Show(img << get size(), img3 << get size, img2 << get size());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Scaled Image variables
Outstanding!
Works perfectly.
Many thanks,
which includes how to properly use the "New Image" function. The attached code is what worked for me.
Neil
col1 = Open(SD1 || samplename2 || "_a1_16col_filt.jpg", jpg);
col1 << Scale(.16);
col1x = New Image(col1);
col1x << Scale(2.2);