<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Answer : </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I Just did not know that it was needed to set 
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>vtkImageData::SetNumberOfScalarComponents(3);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>in addition to </FONT></DIV>
<DIV><FONT face=Arial 
size=2>vtkImageData::SetScalarTypeToUnsignedChar();</FONT></DIV>
<DIV><FONT face=Arial size=2>to be able to set rgb values (0-255 
range)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Does 4 components allow transparency when exported 
as PNG ?</FONT></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=maraux@ondim.fr href="mailto:maraux@ondim.fr">Sebastien_MARAUX</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@public.kitware.com 
  href="mailto:vtkusers@public.kitware.com">vtk mailing list</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, June 05, 2002 1:49 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] how to _ color_ write 
  on a vtkImageCanvasSource2D ?</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=Arial size=2>I would like to draw lines, etc. on a (jpeg read) 
  image data.</FONT></DIV>
  <DIV><FONT face=Arial size=2>I use a vtkimageCanvasSource2D to gain access to 
  the </FONT></DIV>
  <DIV><FONT face=Arial size=2>image data , but when I read the re exported 
  image as a </FONT></DIV>
  <DIV><FONT face=Arial size=2>jpeg </FONT><FONT face=Arial size=2>file, I can 
  only see white drawings.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>What do I do wrong ?</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>snippet : </FONT></DIV>
  <DIV><FONT face=Arial 
  size=2>/*==============================================*/</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;vtkImageData *fond = 
  vtkImageData::New();<BR>&nbsp;fond-&gt;SetDimensions(2048,2048,1);</FONT></DIV>
  <DIV><FONT face=Arial 
  size=2>&nbsp;fond-&gt;SetImageData(jpgReader-&gt;GetOutput());<BR>&nbsp;fond-&gt;SetScalarTypeToUnsignedChar();<BR>&nbsp;fond-&gt;SetNumberOfScalarComponents(3);<BR>&nbsp;fond-&gt;SetExtent(jpgReader-&gt;GetOutput()-&gt;GetExtent());</FONT></DIV><FONT 
  face=Arial size=2>
  <DIV><BR>&nbsp;vtkImageCanvasSource2D *vicsSIG = 
  vtkImageCanvasSource2D::New();<BR>&nbsp;vicsSIG-&gt;SetScalarTypeToUnsignedChar();<BR>&nbsp;vicsSIG-&gt;SetNumberOfScalarComponents(3);<BR>&nbsp;vicsSIG-&gt;SetExtent(fond-&gt;GetExtent());<BR>&nbsp;vicsSIG-&gt;SetDrawColor(0.0,0.0,0.0);<BR>&nbsp;vicsSIG-&gt;FillBox(0,texSize[0],0,texSize[1]);<BR>&nbsp;vicsSIG-&gt;SetDrawColor(255.0,0.0,0.0);<BR>&nbsp;vicsSIG-&gt;FillBox(100,500,100,500);<BR>&nbsp;<BR>&nbsp;vicsSIG-&gt;SetDrawColor(255.0,255.0,0,0);<BR>&nbsp;vicsSIG-&gt;DrawSegment(0,0,1024,1024);</DIV>
  <DIV>&nbsp;vicsSIG-&gt;Update();<BR></DIV>
  <DIV>&nbsp;vtkJPEGWriter 
  *jpgWriter2=vtkJPEGWriter::New();<BR>&nbsp;jpgWriter2-&gt;SetInput(vicsSIG-&gt;GetOutput());<BR>&nbsp;jpgWriter2-&gt;SetFileName("sortie2048.jpg");<BR>&nbsp;jpgWriter2-&gt;SetQuality(95);<BR>&nbsp;jpgWriter2-&gt;ProgressiveOn();<BR>&nbsp;tPrint("\toutputing 
  texture : sorti2048.jpg\n");</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial 
  size=2>/*==============================================*/</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Sebastien 
MARAUX</FONT></DIV></BLOCKQUOTE></BODY></HTML>