Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- GD: How to know image type? (JPEG, PNG, ..)
- Thomas Armstrong
January 15, 2008, 11:36 am
rate this thread
I'm trying to create a Perl script which converts all files within a
directory into JPEG format. First, I read them using two lines
detecting extension (.jpg, .png, ...) but sometimes these files are
wrong and get this error message:
gd-jpeg: JPEG library reports unrecoverable error: Not a JPEG file:
starts with 0x89 0x50
Is there any method to get image type?
Thank you very much.
- Peter Ludikovsky
January 15, 2008, 12:56 pm
Re: GD: How to know image type? (JPEG, PNG, ..)
a) Invoke the divine powers of file(1)
b) open the file & read the identifying characters ...
c) use File::Type;
- » Tk::Browser, "Can't locate object method 'Construct'"
- — Next thread in » PERL Modules Announcements
- » xs module, threads and clone of returned objects
- — Previous thread in » PERL Modules Announcements