Page 1 of 1

How to read JPEG files via ReadImage

Posted: 2009-01-05T10:11:39-07:00
by wchang615
Dear All,

Can someone show me how to read .jpg or .jpeg files by using ReadImage?
The same code can read.gif, .png, etc. with no problem.
I can use WriteImage to create .jpg with no problem.
According to http://www.imagemagick.org/www/formats.html, do I need to install jpeg-6b in order to read .jpg files?

My environment is: XP using Visual Studio 2008.
Any helps would be greatly appreciated.

Best,

--Wo

Re: How to read JPEG files via ReadImage

Posted: 2009-01-05T10:20:02-07:00
by magick
Does reading JPEG work from the command line? Try this command from the Command Prompt window:
  • identify -verbose image.jpg
where image.jpg is the name of a JPEG image you have in the current folder.

Re: How to read JPEG files via ReadImage

Posted: 2009-01-05T10:44:27-07:00
by wchang615
Yes. I can also: convert image.jpg image.ppm with no problem.

--Wo

Re: How to read JPEG files via ReadImage

Posted: 2009-01-05T11:08:12-07:00
by magick
If ReadImage() fails to return an image it tells why in the exception parameter. Post the severity and reason for the exception here and it should clue us into why the method is failing to read your JPEG image.