I been trying to get a handle with Images. I have learned alot from the fine
people here. So, I also learned that thumbnail images look terrible taken
from a digital cam. I know why they look bad. So what is the best way to
resize an image. I'm not too concerned about size, but I guess I would like
to compress it on the upload.
Any thoughts?
Thanks!
RudyYou can resize the image using the GetThumbnailImage method.
Here's more info:
http://msdn.microsoft.com/library/d...
opic.asp
Or maybe you'll find these custom functions useful that I wrote:
public Image DisplaySize(Bitmap bmp)
{
Response.Write(bmp.Width.ToString());
Response.Write(bmp.Height.ToString());
}
//shrink the image proportionately so that neither height nor width is more
than [NewSize] pixels
public System.Drawing.Image ShrinkImage(System.Drawing.Bitmap bmp, int
NewSize)
{
double NewWidth;
double NewHeight;
double ShrinkPercent;
System.Drawing.Image.GetThumbnailImageAbort myCallback =
new System.Drawing.Image. GetThumbnailImageAbort(ThumbnailCallback
);
if (bmp.Width>bmp.Height)
{
NewWidth=NewSize;
ShrinkPercent=(NewWidth/bmp.Width)*100;
NewHeight=(ShrinkPercent/100)*bmp.Height;
}
else
{
NewHeight=NewSize;
ShrinkPercent=(NewHeight/bmp.Height)*100;
NewWidth=(ShrinkPercent/100)*bmp.Width;
}
System.Drawing.Image myShrunkenImage =
bmp. GetThumbnailImage((int)NewWidth,(int)New
Height,myCallback,IntPtr.Zero);
return myShrunkenImage;
}
public bool ThumbnailCallback(){return false;}
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:5E8E9F7F-5147-4F3C-9F40-26F9EC1696E6@.microsoft.com...
> Hello all!
> I been trying to get a handle with Images. I have learned alot from the
> fine
> people here. So, I also learned that thumbnail images look terrible taken
> from a digital cam. I know why they look bad. So what is the best way to
> resize an image. I'm not too concerned about size, but I guess I would
> like
> to compress it on the upload.
> Any thoughts?
> Thanks!
> Rudy
It all depends. If you look at Steve's answer, you will see one way of doing
it. However, if, for example, you want to have a page of thumbnails and
links on each thumbnail to the full-sized image, you may not want to make a
smaller image, but display the image smaller in the browser, using
attributes or style. This, in effect, pre-loads the images, so that when the
thumbnail is clicked on it takes no time for the browser to display the
already-cached image.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S
Is What You Get."Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:5E8E9F7F-5147-4F3C-9F40-26F9EC1696E6@.microsoft.com...
> Hello all!
> I been trying to get a handle with Images. I have learned alot from the
> fine
> people here. So, I also learned that thumbnail images look terrible taken
> from a digital cam. I know why they look bad. So what is the best way to
> resize an image. I'm not too concerned about size, but I guess I would
> like
> to compress it on the upload.
> Any thoughts?
> Thanks!
> Rudy
Hi Kevin!
Would you have an example on how I would do that?
"Kevin Spencer" wrote:
> It all depends. If you look at Steve's answer, you will see one way of doi
ng
> it. However, if, for example, you want to have a page of thumbnails and
> links on each thumbnail to the full-sized image, you may not want to make
a
> smaller image, but display the image smaller in the browser, using
> attributes or style. This, in effect, pre-loads the images, so that when t
he
> thumbnail is clicked on it takes no time for the browser to display the
> already-cached image.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You S
Is What You Get.> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:5E8E9F7F-5147-4F3C-9F40-26F9EC1696E6@.microsoft.com...
>
>
Sure Rudy:
<a href="http://links.10026.com/?link=/images/someimage.jpg"><img src="http://pics.10026.com/?src=/images/someimage.jpg"
style="width:200;height:200"></a>
In the above example, it doesn't matter what size the actual image file is.
The browser will resize it to the specified height and width. NOTE: If you
only set height OR only set width, the other dimension will resize
proportionately. The hyperlink is to the image itself, not a web page. If
the link is clicked, the image will be displayed by itself, un-resized.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S
Is What You Get."Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:3530F794-5CF7-4B63-A4D9-9F8C6E980E88@.microsoft.com...
> Hi Kevin!
> Would you have an example on how I would do that?
> "Kevin Spencer" wrote:
>
though your page may take forever to load. a slicker approach is to use
thumbnails, but preload the full size images with javascript (use the Image
object).
-- bruce (sqlwork.com)
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:%23I8AtQPRFHA.3144@.tk2msftngp13.phx.gbl...
> Sure Rudy:
> <a href="http://links.10026.com/?link=/images/someimage.jpg"><img src="http://pics.10026.com/?src=/images/someimage.jpg"
> style="width:200;height:200"></a>
> In the above example, it doesn't matter what size the actual image file
> is. The browser will resize it to the specified height and width. NOTE: If
> you only set height OR only set width, the other dimension will resize
> proportionately. The hyperlink is to the image itself, not a web page. If
> the link is clicked, the image will be displayed by itself, un-resized.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> What You S
Is What You Get.> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:3530F794-5CF7-4B63-A4D9-9F8C6E980E88@.microsoft.com...
>
This technique is certaintly a good one sometimes, but it can be inefficient
with bandwidth because you're sending the whole (large) image when the
browser is only displaying a tiny version of it.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:%23I8AtQPRFHA.3144@.tk2msftngp13.phx.gbl...
> Sure Rudy:
> <a href="http://links.10026.com/?link=/images/someimage.jpg"><img src="http://pics.10026.com/?src=/images/someimage.jpg"
> style="width:200;height:200"></a>
> In the above example, it doesn't matter what size the actual image file
> is. The browser will resize it to the specified height and width. NOTE: If
> you only set height OR only set width, the other dimension will resize
> proportionately. The hyperlink is to the image itself, not a web page. If
> the link is clicked, the image will be displayed by itself, un-resized.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> What You S
Is What You Get.> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:3530F794-5CF7-4B63-A4D9-9F8C6E980E88@.microsoft.com...
>
Hi Guys!
Kevin, I'll try that tonite and let you know. Bruce, I'm trying to get away
from thumbnails, because they look so pixaleted. I like the idea of
thumbnail, but it doesn't seem to display very clean. Most of the pict's ar
e
from a digital camera, probably set at high quality. Iwould be willing to
sacrefice perfromance for a good pic. Not sure though, I'll try anything.
Thank you both for your suggestions!
Rudy
"Bruce Barker" wrote:
> though your page may take forever to load. a slicker approach is to use
> thumbnails, but preload the full size images with javascript (use the Imag
e
> object).
> -- bruce (sqlwork.com)
>
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:%23I8AtQPRFHA.3144@.tk2msftngp13.phx.gbl...
>
>
Hi Steve,
It seems like there is no middle ground. Either go for good performance or
good pics at a resonable size. I saw your code, do you have a copy of that i
n
vb.net?
You know there is a program called Microsoft Picture manager. I was
experminting last night with the size of my images. There is an option that
prorgram will compress just for a web page. It took the file size down like
from 340k to 30k. The image was smaller, but bigger than a thumbnail, but it
looked great! So I'm thinking if there is a way to convert that file once
it's uploaded, and resave it. I also have looked into converting into png,
not sure if that a way to go.
I'm not to worried about space on my hard drive, I'll have plenty. I don't
want it to be a hassle for people to be restricted of what size to send up,
sticking witht the standard 4mb limit.
Thanks for your time!!
Rudy
"Steve C. Orr [MVP, MCSD]" wrote:
> This technique is certaintly a good one sometimes, but it can be inefficie
nt
> with bandwidth because you're sending the whole (large) image when the
> browser is only displaying a tiny version of it.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:%23I8AtQPRFHA.3144@.tk2msftngp13.phx.gbl...
>
>
Hi Kevin!
I tried your example, couldn't get it to work. Let me show you what I have
for HTML. I'm sure I'm just placing it in wrong. Thanks for all yur help!!
Rudy
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Repeater id="rptPics" runat="server">
<ItemTemplate>
<br>
<asp:Image ImageUrl='<%# Container.DataItem ("filePath") %>'
Runat="server" />
</ItemTemplate>
</asp:Repeater></form>
</body>
"Kevin Spencer" wrote:
> Sure Rudy:
> <a href="http://links.10026.com/?link=/images/someimage.jpg"><img src="http://pics.10026.com/?src=/images/someimage.jpg"
> style="width:200;height:200"></a>
> In the above example, it doesn't matter what size the actual image file is
.
> The browser will resize it to the specified height and width. NOTE: If you
> only set height OR only set width, the other dimension will resize
> proportionately. The hyperlink is to the image itself, not a web page. If
> the link is clicked, the image will be displayed by itself, un-resized.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You S
Is What You Get.> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:3530F794-5CF7-4B63-A4D9-9F8C6E980E88@.microsoft.com...
>
>
0 comments:
Post a Comment