Hi, I'm a newbie to VB.NET and I am trying to create thumbnails from .jpg
files (my travel pictures) to
post on a website. I want to create an executable that I can put in a
directory containing my jpg images which will create the thumbnails with a
"-t.jpg" extenstion. I found this code below which will create a thumbnail
from a specified file, "randomphoto.jpg".
Sub Thumbnail()
Dim myCallback As System.Drawing.Image.GetThumbnailImageAbort
Dim myPtr As IntPtr
Dim myPic As New Bitmap("E:\randomphoto.jpg")
Dim myThumb As System.Drawing.Image = myPic.GetThumbnailImage(100, 100,
myCallback, myPtr)
myThumb.Save("E:\mythumb.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
How can I alter this code to pick out any .jpg file in the current directory
and create a thumbnail. Do I use a looping structure to read each file and
run the above module? Any help in pointing me in the right direction
appreciated.
James 3 4648
* "James" <ja***@nowhere.net> scripsit: Hi, I'm a newbie to VB.NET and I am trying to create thumbnails from .jpg files (my travel pictures) to post on a website. I want to create an executable that I can put in a directory containing my jpg images which will create the thumbnails with a "-t.jpg" extenstion. I found this code below which will create a thumbnail from a specified file, "randomphoto.jpg".
Sub Thumbnail() Dim myCallback As System.Drawing.Image.GetThumbnailImageAbort Dim myPtr As IntPtr Dim myPic As New Bitmap("E:\randomphoto.jpg") Dim myThumb As System.Drawing.Image = myPic.GetThumbnailImage(100, 100, myCallback, myPtr) myThumb.Save("E:\mythumb.jpg", System.Drawing.Imaging.ImageFormat.Jpeg) End Sub
How can I alter this code to pick out any .jpg file in the current directory and create a thumbnail. Do I use a looping structure to read each file and run the above module? Any help in pointing me in the right direction appreciated.
\\\
Dim s As String
For Each s In System.IO.Directory.GetFiles("C:\foo")
...
Next s
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Hi James, Hi, I'm a newbie to VB.NET and I am trying to create thumbnails from .jpg files (my travel pictures) to post on a website. I want to create an executable that I can put in a directory containing my jpg images which will create the thumbnails with a "-t.jpg" extenstion. I found this code below which will create a thumbnail from a specified file, "randomphoto.jpg".
Sub Thumbnail() Dim myCallback As System.Drawing.Image.GetThumbnailImageAbort Dim myPtr As IntPtr Dim myPic As New Bitmap("E:\randomphoto.jpg") Dim myThumb As System.Drawing.Image = myPic.GetThumbnailImage(100, 100, myCallback, myPtr) myThumb.Save("E:\mythumb.jpg", System.Drawing.Imaging.ImageFormat.Jpeg) End Sub
How can I alter this code to pick out any .jpg file in the current directory and create a thumbnail. Do I use a looping structure to read each file and run the above module? Any help in pointing me in the right direction appreciated.
Check the GetFiles()-method from the DirectoryInfo-Class, which gives you
all the files in a directory as FileInfo-Objects. You can use those in a
loop to create your thumbnails.
Regards,
Frank Eller www.frankeller.de
Have a read of something like this. http://support.microsoft.com/default...4&ID=kb;en-us;
Q303974&SD=MSDN
You could even automate the process. Why dont you try to find an example of
filesystemwatcher. If you made it watch for changes in the directory (ie.
new jpg's) then you could make it automatically create the thumbnails for
you.
--
Regards
John Timney
Microsoft Regional Director
Microsoft MVP
"James" <ja***@nowhere.net> wrote in message
news:40**********************@news.dial.pipex.com. .. Hi, I'm a newbie to VB.NET and I am trying to create thumbnails from .jpg files (my travel pictures) to post on a website. I want to create an executable that I can put in a directory containing my jpg images which will create the thumbnails with a "-t.jpg" extenstion. I found this code below which will create a
thumbnail from a specified file, "randomphoto.jpg".
Sub Thumbnail() Dim myCallback As System.Drawing.Image.GetThumbnailImageAbort Dim myPtr As IntPtr Dim myPic As New Bitmap("E:\randomphoto.jpg") Dim myThumb As System.Drawing.Image = myPic.GetThumbnailImage(100,
100, myCallback, myPtr) myThumb.Save("E:\mythumb.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg) End Sub
How can I alter this code to pick out any .jpg file in the current
directory and create a thumbnail. Do I use a looping structure to read each file
and run the above module? Any help in pointing me in the right direction appreciated. James
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John |
last post by:
I am trying to create thumbnails from 2500 pictures. But I always get
a Maximum execution time of 30 seconds exceeded" at the statement with
the method with imagejpeg or imagedestroy after...
|
by: bob4roxio |
last post by:
Is there any better quality method for creating resized images? I'm
using imagecreatetruecolor and imagecopyresampled and making sure my
imagejpeg quality is set at 100 but the client I'm writing...
|
by: sepgy |
last post by:
Can anyone help me to use a python to create an HTML photo gallery
generator. When it's finished, it will be able find all the picture
files (i.e. .jpg, .gif. .png files) in any given folder on the...
|
by: James |
last post by:
Hi, I'm a newbie to VB.NET and I am trying to create thumbnails from .jpg
files (my travel pictures) to
post on a website. I want to create an executable that I can put in a
directory containing...
|
by: Ken |
last post by:
Hi all:
I have created a vb.net service that watches a directory and when an
image is placed in the directory a thumbnail of the image is created. The
problem I am having is a...
|
by: David Lozzi |
last post by:
Hello,
I'm wondering whats the best method to use for displaying several photos'
thumbnails. One method I know is to dynamically resize the photo at the time
the page is loaded. What does this...
|
by: Duane Phillips |
last post by:
On image upload, I would like to save the image and also auto-create a
right-size image for faster browsing, and also a thumbnail for indexes, so
that slower connections do not have to wait for the...
|
by: ctiggerf |
last post by:
I was hopeing someone could help me out here. Been stumped on this
one all day.
This function
1. Checks uploaded files.
2. Creates two resized images from each (a full size, and a...
|
by: amsablotny |
last post by:
Hi all,
I am a newbie at this. I am trying to create thumbnails. However, I
am only creating black image with the correct thumbnail size. I am
using php 5.1.6 and GD 2.0.28. Below is the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |