Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Repost: Speed of inserting pictures and Excel memory

Thanks Peter. I was using a For Each loop to delete the photos for the
scrolling feature. I like your batch delete method better.

I did a brief experiment with the Shapes.AddPicture method and found it did
not behave the same. Initializing the photos had no affect, but this was only
a very brief experiment.

If I go the route of using Shapes.AddPicture then (apparently) I'll need to
add functionality that allows the user to specify the height/width ratio. In
my case, all the photos for a given survey will be the same size but the size
may change between surveys (i.e. cameras or camera settings may change). I
keep wondering if I'm missing something because it seems everyone should be
bitching about this problem: If you don't know the correct proportionality
for the photos, then they will be distorted if you specify incorrect values
for the width and height arguments. As you may have noticed in my code, I
currently insert the photos using Pictures.Insert and test for the height and
width and obtain the proportionality this way. I then change the size to suit.

Regards,
Greg

"Peter T" wrote:

Hi Greg,

I have some routines that add large numbers of pictures from file, resized
and placed to suit. Like you, I find the first time in a session of Excel I
add a picture is significantly slower than subsequently. Strangely, normally
(but not always) it's only slow for the first inserted picture assuming all
in the same folder, Unlike you I don't find resizing & placing is relevant
as regards time.

I don't find any reason to use an InitializePhotos routine such as yours.
The "extra" time is same if inserted & deleted to a dummy sheet or as & when
required. Instead I add direct to the active sheet. I don't disable
screenupdating but I ensure I scroll well away both from the active cell
(where the picture will first be inserted) and less importantly away from
where any will be moved after resizing. Then I scroll or "Goto" back.

If I know all the original picture H/W proportions are identical, instead of
insert pictures, sizing & placing, I use the AddPicture method and do all in
one go.

FWIW, to delete ALL pictures on a sheet simply:
..Pictures.Delete

Regards,
Peter T


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Repost: Speed of inserting pictures and Excel memory

Hi Greg,

I don't think AddPicture vs Insert.Picture will make any difference as
regards the main issue that the first time to add/insert is slower. Also as
you say, the first time the picture is ever drawn it can flicker, perhaps
only noticeable with very large image files. Anyway it's two separate delays
that one way or another are not going to be avoided, at least I don't think
so.

If interested I can send a stripped down version of a few things from my xls
image browser.
Insert Next or Previous image in current folder
optionally change size, fade in rate
or
Insert all images from current folder
optionally change size, gap width

change current folder with GetOpenFileName

It does not disable screenupdating nor preload images yet I think reasonably
smooth. What might be of interest to you is all insert & resizing is done
outside the visible range before moving into it.

Regards,
Peter T
email: pmbthornton gmail com

"Greg Wilson" wrote in message
...
Thanks Peter. I was using a For Each loop to delete the photos for the
scrolling feature. I like your batch delete method better.

I did a brief experiment with the Shapes.AddPicture method and found it

did
not behave the same. Initializing the photos had no affect, but this was

only
a very brief experiment.

If I go the route of using Shapes.AddPicture then (apparently) I'll need

to
add functionality that allows the user to specify the height/width ratio.

In
my case, all the photos for a given survey will be the same size but the

size
may change between surveys (i.e. cameras or camera settings may change). I
keep wondering if I'm missing something because it seems everyone should

be
bitching about this problem: If you don't know the correct proportionality
for the photos, then they will be distorted if you specify incorrect

values
for the width and height arguments. As you may have noticed in my code, I
currently insert the photos using Pictures.Insert and test for the height

and
width and obtain the proportionality this way. I then change the size to

suit.

Regards,
Greg

"Peter T" wrote:

Hi Greg,

I have some routines that add large numbers of pictures from file,

resized
and placed to suit. Like you, I find the first time in a session of

Excel I
add a picture is significantly slower than subsequently. Strangely,

normally
(but not always) it's only slow for the first inserted picture assuming

all
in the same folder, Unlike you I don't find resizing & placing is

relevant
as regards time.

I don't find any reason to use an InitializePhotos routine such as

yours.
The "extra" time is same if inserted & deleted to a dummy sheet or as &

when
required. Instead I add direct to the active sheet. I don't disable
screenupdating but I ensure I scroll well away both from the active cell
(where the picture will first be inserted) and less importantly away

from
where any will be moved after resizing. Then I scroll or "Goto" back.

If I know all the original picture H/W proportions are identical,

instead of
insert pictures, sizing & placing, I use the AddPicture method and do

all in
one go.

FWIW, to delete ALL pictures on a sheet simply:
..Pictures.Delete

Regards,
Peter T




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Repost: Speed of inserting pictures and Excel memory

Thanks for the offer Peter.

Today I revamped a copy of my project to use Shapes.AddPicture instead of
Pictures.Insert. I found that I was mistaken in my comment that it behaved
differently. It in fact behaves exactly the same as far as I can tell.

My project requires me to be able to handle potentially several hundred
photos and to be able to scroll through them with no difficulties. That's why
I use the technique of systematic deletion and reimportation for my scrolling
feature. This way, the file size stays small. However, as I mentioned, the
file names get copied to a hidden worksheet and the layout of the names
models the actual picture layout: X names (photos) long by Y names (photos)
wide. I use nested loops to retrieve the names during the scrolling process
which slows things down explaining why I'm more affected than you. There is
also a lot of code for other features in the project.

The delay isn't that bad but I want the scrolling feature to be really
slick. Imagine scrolling through photos that encompass a complete bridge. You
need to scroll from one end to the other before Excel has seen all the photos
and the problem goes away.

You might want to reconsider the IntializePhotos approach. It only takes a
few seconds to cycle through a couple hundred photos, after which there is
virtually no delay with my scroll feature. It appears to be the case that
unless the photos are within the visible range they don't get drawn which
explains why it doesn't work otherwise. Of course, don't do this unless there
is a need.

I very much appreciate your offer but the functionalities you mention that I
would need have already been created and the project is quite complex. It
would require a great deal of work to revamp. I've adapted your suggestion of
ws.Pictures.Delete instead of using a loop. I also assign macros to the
photos for another situation and use ws.Pictures.OnAction = "XYZ" which batch
assigns the macros.

Best regards,
Greg

"Peter T" wrote:

Hi Greg,

I don't think AddPicture vs Insert.Picture will make any difference as
regards the main issue that the first time to add/insert is slower. Also as
you say, the first time the picture is ever drawn it can flicker, perhaps
only noticeable with very large image files. Anyway it's two separate delays
that one way or another are not going to be avoided, at least I don't think
so.

If interested I can send a stripped down version of a few things from my xls
image browser.
Insert Next or Previous image in current folder
optionally change size, fade in rate
or
Insert all images from current folder
optionally change size, gap width

change current folder with GetOpenFileName

It does not disable screenupdating nor preload images yet I think reasonably
smooth. What might be of interest to you is all insert & resizing is done
outside the visible range before moving into it.

Regards,
Peter T
email: pmbthornton gmail com

"Greg Wilson" wrote in message
...
Thanks Peter. I was using a For Each loop to delete the photos for the
scrolling feature. I like your batch delete method better.

I did a brief experiment with the Shapes.AddPicture method and found it

did
not behave the same. Initializing the photos had no affect, but this was

only
a very brief experiment.

If I go the route of using Shapes.AddPicture then (apparently) I'll need

to
add functionality that allows the user to specify the height/width ratio.

In
my case, all the photos for a given survey will be the same size but the

size
may change between surveys (i.e. cameras or camera settings may change). I
keep wondering if I'm missing something because it seems everyone should

be
bitching about this problem: If you don't know the correct proportionality
for the photos, then they will be distorted if you specify incorrect

values
for the width and height arguments. As you may have noticed in my code, I
currently insert the photos using Pictures.Insert and test for the height

and
width and obtain the proportionality this way. I then change the size to

suit.

Regards,
Greg

"Peter T" wrote:

Hi Greg,

I have some routines that add large numbers of pictures from file,

resized
and placed to suit. Like you, I find the first time in a session of

Excel I
add a picture is significantly slower than subsequently. Strangely,

normally
(but not always) it's only slow for the first inserted picture assuming

all
in the same folder, Unlike you I don't find resizing & placing is

relevant
as regards time.

I don't find any reason to use an InitializePhotos routine such as

yours.
The "extra" time is same if inserted & deleted to a dummy sheet or as &

when
required. Instead I add direct to the active sheet. I don't disable
screenupdating but I ensure I scroll well away both from the active cell
(where the picture will first be inserted) and less importantly away

from
where any will be moved after resizing. Then I scroll or "Goto" back.

If I know all the original picture H/W proportions are identical,

instead of
insert pictures, sizing & placing, I use the AddPicture method and do

all in
one go.

FWIW, to delete ALL pictures on a sheet simply:
..Pictures.Delete

Regards,
Peter T





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Repost: Speed of inserting pictures and Excel memory

Hi, Greg,

Appreciate the detailed explanation of what you're doing, sounds like an
interesting project.

I use nested loops to retrieve the names during the scrolling process
which slows things down explaining why I'm more affected than you.


I'm surprised looping a string array of 500 would slow things relative to
anything to do with manipulating pictures. Perhaps maintaining an index
system might avoid any looping at all.

But that's in passing, sounds like you've got things pretty well optimized.

Regards,
Peter T


"Greg Wilson" wrote in message
...
Thanks for the offer Peter.

Today I revamped a copy of my project to use Shapes.AddPicture instead of
Pictures.Insert. I found that I was mistaken in my comment that it behaved
differently. It in fact behaves exactly the same as far as I can tell.

My project requires me to be able to handle potentially several hundred
photos and to be able to scroll through them with no difficulties. That's

why
I use the technique of systematic deletion and reimportation for my

scrolling
feature. This way, the file size stays small. However, as I mentioned, the
file names get copied to a hidden worksheet and the layout of the names
models the actual picture layout: X names (photos) long by Y names

(photos)
wide. I use nested loops to retrieve the names during the scrolling

process
which slows things down explaining why I'm more affected than you. There

is
also a lot of code for other features in the project.

The delay isn't that bad but I want the scrolling feature to be really
slick. Imagine scrolling through photos that encompass a complete bridge.

You
need to scroll from one end to the other before Excel has seen all the

photos
and the problem goes away.

You might want to reconsider the IntializePhotos approach. It only takes a
few seconds to cycle through a couple hundred photos, after which there is
virtually no delay with my scroll feature. It appears to be the case that
unless the photos are within the visible range they don't get drawn which
explains why it doesn't work otherwise. Of course, don't do this unless

there
is a need.

I very much appreciate your offer but the functionalities you mention that

I
would need have already been created and the project is quite complex. It
would require a great deal of work to revamp. I've adapted your suggestion

of
ws.Pictures.Delete instead of using a loop. I also assign macros to the
photos for another situation and use ws.Pictures.OnAction = "XYZ" which

batch
assigns the macros.

Best regards,
Greg

"Peter T" wrote:

Hi Greg,

I don't think AddPicture vs Insert.Picture will make any difference as
regards the main issue that the first time to add/insert is slower. Also

as
you say, the first time the picture is ever drawn it can flicker,

perhaps
only noticeable with very large image files. Anyway it's two separate

delays
that one way or another are not going to be avoided, at least I don't

think
so.

If interested I can send a stripped down version of a few things from my

xls
image browser.
Insert Next or Previous image in current folder
optionally change size, fade in rate
or
Insert all images from current folder
optionally change size, gap width

change current folder with GetOpenFileName

It does not disable screenupdating nor preload images yet I think

reasonably
smooth. What might be of interest to you is all insert & resizing is

done
outside the visible range before moving into it.

Regards,
Peter T
email: pmbthornton gmail com

"Greg Wilson" wrote in message
...
Thanks Peter. I was using a For Each loop to delete the photos for the
scrolling feature. I like your batch delete method better.

I did a brief experiment with the Shapes.AddPicture method and found

it
did
not behave the same. Initializing the photos had no affect, but this

was
only
a very brief experiment.

If I go the route of using Shapes.AddPicture then (apparently) I'll

need
to
add functionality that allows the user to specify the height/width

ratio.
In
my case, all the photos for a given survey will be the same size but

the
size
may change between surveys (i.e. cameras or camera settings may

change). I
keep wondering if I'm missing something because it seems everyone

should
be
bitching about this problem: If you don't know the correct

proportionality
for the photos, then they will be distorted if you specify incorrect

values
for the width and height arguments. As you may have noticed in my

code, I
currently insert the photos using Pictures.Insert and test for the

height
and
width and obtain the proportionality this way. I then change the size

to
suit.

Regards,
Greg

"Peter T" wrote:

Hi Greg,

I have some routines that add large numbers of pictures from file,

resized
and placed to suit. Like you, I find the first time in a session of

Excel I
add a picture is significantly slower than subsequently. Strangely,

normally
(but not always) it's only slow for the first inserted picture

assuming
all
in the same folder, Unlike you I don't find resizing & placing is

relevant
as regards time.

I don't find any reason to use an InitializePhotos routine such as

yours.
The "extra" time is same if inserted & deleted to a dummy sheet or

as &
when
required. Instead I add direct to the active sheet. I don't disable
screenupdating but I ensure I scroll well away both from the active

cell
(where the picture will first be inserted) and less importantly away

from
where any will be moved after resizing. Then I scroll or "Goto"

back.

If I know all the original picture H/W proportions are identical,

instead of
insert pictures, sizing & placing, I use the AddPicture method and

do
all in
one go.

FWIW, to delete ALL pictures on a sheet simply:
..Pictures.Delete

Regards,
Peter T






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting pictures into Excel Sheet at a particular size ToferKing Excel Discussion (Misc queries) 5 February 25th 10 07:03 PM
Speed of Excel When Inserting & Deleting Rows Gerry Excel Discussion (Misc queries) 13 March 5th 08 04:04 AM
Inserting pictures in Excel 2003 jawone48 Excel Discussion (Misc queries) 6 August 11th 07 06:17 AM
Excel memory and speed when inserting pictures ??? Greg Wilson Excel Programming 2 September 14th 05 09:01 AM
Memory Leak Excel 2003 vs 2000 using linked pictures Scriptick Excel Programming 0 April 27th 05 04:16 PM


All times are GMT +1. The time now is 06:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"