Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

Creating thumbnail on the fly

I would like to display a thumbnail as a link to a full size image, without creating a thumbnail using an image editor or loading the full sized file.  Is this possible?
0
Darrick
Asked:
Darrick
  • 5
  • 3
  • 2
  • +1
1 Solution
 
mark2150Commented:
No.

In order to create a thumbnail you need to read the entire file even if you're discarding 3/4 of the data. Remember that images are normally stored in line order. That is the first line of the image is the start of the file and the last line is the end of the file. When you create a thumb at, say, 1/4 the main resolution, you'll skip every other line and discard every other pixel on the lines you do keep. This means to draw the bottom row of the thumb you have to read either the last or next to last line of the full size image to get the bottom row's data. Since you've had to slow thru the entire image anyway, you might as well have shown the full image to begin with as you've sent the whole thing over the wire anyway.

If you're clever, you can cache the image locally once it's been sent the first time and only display the thumb on subsequient lookups, however since both NS and IE already do this there is no noticable speed advantage.

M
0
 
compmaniaCommented:
If this is for a webpage sure (if I am reading the question right)
I did it for my graphics at http://computergraphics.8m.com

Just check the source, all you need to do is load the image and tell it to use a smaller image size. (I think I resized my images so they would load faster but I have done it before without doing that)
0
 
mark2150Commented:
Scaling down doesn't speed things up. You're going to read the full file even if you only show 10% of the image. This will make your page appear dog-slow as it will take forever to load a small rectangle.

Perhaps you should look at progressive GIF's and have the low res and high res images cascaded.

M
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
DarrickAuthor Commented:
M

Could you explain?

Darrick
0
 
DarrickAuthor Commented:
M

Could you explain?

Darrick
0
 
mark2150Commented:
Progressive GIF's store multiple images in a single file. You can have a low rez image as the first thing displayed. It'll be blocky but you'll get an idea of the image before you spend the bandwidth to see the next image in the set.

If you browse with autoload of images turned OFF (set in the preferences of both IE and NS) then all you'll see is the outlines. Then if you select an image and click to see it you'll get the first image in the series. Click it again and you'll get the next image. Sometimes the images are stored with fewer colors than the final or even in B/W.

I don't have a progressive GIF handy to show but that's how they work.

One problem with the .GIF format is that it's a licensed format and you'll have to pay for a .GIF creator or something on the license.

M
0
 
compmaniaCommented:
Scaling down does speed things up because of less data, if I have a 480x360 pixel image and change it to a 200x150 it will load faster. I don't think just changing it using html tags will make it load faster.
0
 
mark2150Commented:
Yeah, resizing the data file reduces the amount of data sent over the wire. Having the image resized in HTML leaves the file size alone and just rescales it down for display and sends the WHOLE file over the wire.

M
0
 
NevaCommented:
As far as I am aware, there is no way to size-down an image--in both data size and image size--without using an image editor.  HTML can be used to scale down the image, but it will STILL BE THE FULL DATA SIZE.  This is NOT a decent option to use.  Your best bet is to download Paintshop Pro or something and use that to scale it down to thumbnail-size.

Hope this helps.
0
 
mark2150Commented:
Neva,

Welcome to E-E!

However please understand that the Experts here at E-E have developed a system where it's considered impolite to post and *Answer* that is very similar to previously posted *comments*. The questioner has the option of accepting any comment as an answer and thus we all tend to post just comments to keep the question open and active. The questioner will then accept whatever comment they feel best helps them.

Please change you answer to a comment to insure that the question is reviewed by other experts.

M
0
 
DarrickAuthor Commented:
Neva

Please see above comment from M

Darrick
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now