jaimerai souvgarder une image bitmap au format tiff 8 BPP , merci de maidee
Version imprimable
jaimerai souvgarder une image bitmap au format tiff 8 BPP , merci de maidee
Bonjour merci ...
Sinon ça devrais faire un truc dans cet esprit :
Code:
1
2
3
4
5
6 void ConvertirBMP(string source, string dest) { Image m = Image.FromFile(source); m.Save(dest, System.Drawing.Imaging.ImageFormat.Tiff); }
merci pour ta réponse , jai utilise deja ca:mais l'image que jai obtenu et tiff 24 BPP pas 8 BPP, et pour tent l'image de l'entre et de 8 BPP , ta une idee sur ce pb ?Code:
1
2
3
4
5 void ConvertirBMP(string source, string dest) { Image m = Image.FromFile(source); m.Save(dest, System.Drawing.Imaging.ImageFormat.Tiff); }
C'est un peu plus compliqué (enfin, surtout pas très intuitif), il faut passer un paramètre à l'encodeur. Ce code est inspiré de la doc MSDN de Encoder.ColorDepth, et fonctionne :
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 private void ConvertToTiff8BPP(string bmpPath, string tiffPath) { Image img = Image.FromFile(bmpPath); ImageCodecInfo codecInfo = GetEncoderInfo("image/tiff"); EncoderParameters prms = new EncoderParameters(); prms.Param[0] = new EncoderParameter( System.Drawing.Imaging.Encoder.ColorDepth, 8L); img.Save(tiffPath, codecInfo, prms); } private static ImageCodecInfo GetEncoderInfo(String mimeType) { int j; ImageCodecInfo[] encoders; encoders = ImageCodecInfo.GetImageEncoders(); for (j = 0; j < encoders.Length; ++j) { if (encoders[j].MimeType == mimeType) return encoders[j]; } return null; }
Merci a vous reponses