How to read JPEG files via ReadImage

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
wchang615

How to read JPEG files via ReadImage

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to read JPEG files via ReadImage

Post 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.
wchang615

Re: How to read JPEG files via ReadImage

Post by wchang615 »

Yes. I can also: convert image.jpg image.ppm with no problem.

--Wo
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to read JPEG files via ReadImage

Post 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.
Post Reply