Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2006

Tip: Looking for answers? Try searching our database.

How to recognize a JPEG or a GIF image when the file has no extension?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Clément - 28 Apr 2006 17:16 GMT
Hi!

I download images which have no extension, with a System.Net.WebClient.
I would like to save them with a different name and with the extension
.jpg if they really are of JPEG type. Because sometimes I could receive
GIF images, and I would like to do the same.

I tried to look for the image type in the WebClient object, but I
didn't find anything.
And once the file has been saved without an extension on my computer,
when I right-click on it, and then Properties and Summary, Windows
seems to know that it is a JPEG or a GIF file.

I read on the internet that these informations are contained in the
IPTC datas, but I have no idea on how to get them from the file.

Any ideas for that would be welcome.

Thx in advance.
It is pretty much a hurry!!

Clement
Gabriele G. Ponti - 28 Apr 2006 20:05 GMT
Read the first few bytes of the files, and check for a valid header.

GIF header information
http://www.onicos.com/staff/iz/formats/gif.html

JPEG header information
http://www.obrador.com/essentialjpeg/HeaderInfo.htm

> Hi!
>
[quoted text clipped - 18 lines]
>
> Clement

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.