Click here to Skip to main content
16,004,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: History List in TextBox Pin
ravalosv25-May-05 12:21
ravalosv25-May-05 12:21 
GeneralRegex Help please Pin
J4amieC25-May-05 5:39
J4amieC25-May-05 5:39 
GeneralRe: Regex Help please Pin
Bitwise Gamgee25-May-05 7:53
Bitwise Gamgee25-May-05 7:53 
GeneralRe: Regex Help please Pin
J4amieC25-May-05 22:04
J4amieC25-May-05 22:04 
GeneralRe: Regex Help please Pin
John Fisher25-May-05 8:04
John Fisher25-May-05 8:04 
GeneralAdd an icon to the form bar to reduce to systemtray icon Pin
Sasuko25-May-05 5:24
Sasuko25-May-05 5:24 
GeneralCreating CHM Tool Pin
r0ssta25-May-05 5:22
r0ssta25-May-05 5:22 
Generalproblem with Image.Save : EncoderParameter(ColorDepth, ??) Pin
kyfranBibax25-May-05 5:11
kyfranBibax25-May-05 5:11 
Hi,

I've a problem when I want to save my image and reducing color number

I think that my bad parameter is the EncoderParameters
This is my code :
myImageCodecInfo = GetEncoderInfo("image/tiff");
// EncoderParameter object in the array.
myEncoderParameters = new EncoderParameters(1);
// Save the image with a color depth of 7 bits per pixel (128 colors).
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.ColorDepth, 7);
picChart.Image.Save(rasterFileNameTif,myImageCodecInfo,myEncoderParameters);


But I've an exception :

System.ArgumentException: Invalid parameter used.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at displayRaster.displayRaster.ChangeRasterFormat() in c:\documents and settings\franck\mes documents\visual studio projects\displayraster\displayraster.cs:line 176


When I compile the only example that I found :
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.ColorDepth, 24L);

It works with all files format (I have no exception...) but not with .tif file and I have this :

System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at displayRaster.displayRaster.ChangeRasterFormat() in c:\documents and settings\franck\mes documents\visual studio projects\displayraster\displayraster.cs:line 176


So, I have some question Confused | :confused: :

Is somebody can explain to me how works the second parameter after ColorDepth (24L).
Alors, j'ai quelques petites questions :

To reduce color number to 128, it's corresponds to bpp (2^7 = 128)?

Thx for replies

Have a nice dayCool | :cool:


bibax n fait un max!
Generalswitched from VB Pin
Anonymous25-May-05 5:09
Anonymous25-May-05 5:09 
GeneralRe: switched from VB Pin
Stefan Troschuetz25-May-05 5:28
Stefan Troschuetz25-May-05 5:28 
GeneralNUnit -- Testing separate files Pin
vcfirth25-May-05 4:01
vcfirth25-May-05 4:01 
GeneralIEnumerator<> and IDisposable? (VS2005) Pin
Jon Hulatt25-May-05 3:54
Jon Hulatt25-May-05 3:54 
GeneralRe: IEnumerator<> and IDisposable? (VS2005) Pin
Judah Gabriel Himango25-May-05 4:10
sponsorJudah Gabriel Himango25-May-05 4:10 
GeneralHaving trouble with custom combo box Pin
Flack25-May-05 3:45
Flack25-May-05 3:45 
GeneralRegion hit test Pin
MandMG25-May-05 2:46
MandMG25-May-05 2:46 
GeneralRe: Region hit test Pin
mav.northwind25-May-05 2:54
mav.northwind25-May-05 2:54 
GeneralRe: Region hit test Pin
MandMG25-May-05 3:05
MandMG25-May-05 3:05 
GeneralRijndael encryption with .Net and decryption with native class Pin
hubbobubbo25-May-05 2:40
hubbobubbo25-May-05 2:40 
GeneralApplication for PDA barcode scanner Pin
verma-rahul25-May-05 2:20
verma-rahul25-May-05 2:20 
Generalconversion of db file in to csv file Pin
shashank veerkar25-May-05 0:53
shashank veerkar25-May-05 0:53 
GeneralRe: conversion of db file in to csv file Pin
rudy.net25-May-05 3:14
rudy.net25-May-05 3:14 
QuestionActiveX EXE equivalent? Pin
25-May-05 0:15
suss25-May-05 0:15 
AnswerRe: ActiveX EXE equivalent? Pin
John Fisher25-May-05 7:43
John Fisher25-May-05 7:43 
GeneralRe: ActiveX EXE equivalent? Pin
Member 199247025-May-05 23:05
Member 199247025-May-05 23:05 
Generalusing string[] to call dll for const char *arg[] Pin
hhmmdd24-May-05 23:31
hhmmdd24-May-05 23:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.