[vtkusers] JPEGImageWriter to memory (C++)

Andrew Higginson at.higginson at gmail.com
Fri Apr 22 19:11:37 EDT 2016


Hi all,


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++.


To do this I believe I need something like the following:

----
vtkSmartPointer<vtkJPEGWriter> writer =
vtkSmartPointer<vtkJPEGWriter>::New();
writer->SetWriteToMemory(true);
writer->SetInputData(...);
writer->Write();

vtkUnsignedCharArray* d = writer->GetResult();
----


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:


----
char* data = d->...
size_t size = d->...
----



But I am not sure how to do this. Any help would be greatly appreciated :)


Thanks,
Andrew Higginson
-- 

Andrew Higginson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160422/3a05a1ff/attachment.html>


More information about the vtkusers mailing list