By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,238 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,238 IT Pros & Developers. It's quick & easy.

How to Merge 2 JPEG files into one file.

P: n/a
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

Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
GIFs can be animated, but JPEGs cannot, so a multiframe JPEG is invalid.

"Imtiaz" <Im****@discussions.microsoft.com> schrieb im Newsbeitrag
news:F7**********************************@microsof t.com...
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

Nov 16 '05 #2

P: n/a
cody wrote:
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" <Im****@discussions.microsoft.com> schrieb im Newsbeitrag
news:F7**********************************@microsof t.com...
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

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.