<div dir="ltr">Fab it works! <div><br></div><div>I think I also had issues with trying to use the data directly, however after copying it to a new location with memcpy everything worked.</div><div><br></div><div>Cheers :)</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, 23 Apr 2016 at 12:25 David E DeMarle <<a href="mailto:dave.demarle@kitware.com">dave.demarle@kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Try:<div>char *data = (char*)d->GetVoidPointer();<div>size_t size = (size_t)(d->GetSize()*d->GetDataTypeSize());</div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br clear="all"><div><div>David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909</div></div>
<br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 22, 2016 at 7:11 PM, Andrew Higginson <span dir="ltr"><<a href="mailto:at.higginson@gmail.com" target="_blank">at.higginson@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<br><br><br>I am trying to use a vtkJPEGImageWriter to write a JPEG file to memory (instead of writing to disk and then reading it again using fopen or similar) in C++.<br><br><br>To do this I believe I need something like the following:<br><br>----<br>vtkSmartPointer<vtkJPEGWriter> writer = vtkSmartPointer<vtkJPEGWriter>::New();<br>writer->SetWriteToMemory(true);<br>writer->SetInputData(...);<br>writer->Write();<br><br>vtkUnsignedCharArray* d = writer->GetResult();<br>----<br><br><br>However at this point I don't know how to extract what I need from the vtkUnsignedCharArray. I would like the raw bytes and size, like so:<br><br><br>----<br>char* data = d->...<br>size_t size = d->...<br>----<br><br><br><br>But I am not sure how to do this. Any help would be greatly appreciated :)<br><br><br>Thanks,<br>Andrew Higginson</div><span><font color="#888888"><div dir="ltr">-- <br></div><p dir="ltr"></p>
<p dir="ltr">Andrew Higginson</p>
</font></span><br></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><div dir="ltr">-- <br></div><p dir="ltr"></p>
<p dir="ltr">Andrew Higginson</p>