How to Merge 2 JPEG files into one file.

G

Guest

Hi,

I have two JPEG Images. Now I wanted to merge them into one image. I am
trying to use Image.SaveAdd to do this. But it is throwing an exception
"Invalid parameter used."

Following is the code:
Image mapImage = Image.FromFile (filename);
Image legendImage = Image.FromFile (filename2);
EncoderParameters parameters = new EncoderParameters(1);

parameters.Param[0] = new EncoderParameter( Encoder.SaveFlag,
(long)EncoderValue.MultiFrame);
mapImage.SaveAdd( legendImage, parameters );

Can any one tell me what parameter should I use ?

Thanking you in Anticipation
Regards
Imtiaz
 
H

Hans Kesting

cody said:
GIFs can be animated, but JPEGs cannot, so a multiframe JPEG is
invalid.

But note: the .Net framework (at least up to version 1.1) can't generate
animated gif's. The "MultiFrame" is provided for tiff files that can store multiple
images in a single file, with no amination support. (for one thing: it's not possible
to define timing).

Hans Kesting

Imtiaz said:
Hi,

I have two JPEG Images. Now I wanted to merge them into one image.
I am trying to use Image.SaveAdd to do this. But it is throwing an
exception "Invalid parameter used."

Following is the code:
Image mapImage = Image.FromFile (filename);
Image legendImage = Image.FromFile (filename2);
EncoderParameters parameters = new EncoderParameters(1);

parameters.Param[0] = new EncoderParameter( Encoder.SaveFlag,
(long)EncoderValue.MultiFrame);
mapImage.SaveAdd( legendImage, parameters );

Can any one tell me what parameter should I use ?

Thanking you in Anticipation
Regards
Imtiaz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top