26 #ifndef SCRIBO_IO_XML_INTERNAL_SAVE_IMAGE_TO_XML_HH
27 # define SCRIBO_IO_XML_INTERNAL_SAVE_IMAGE_TO_XML_HH
37 # include <mln/core/concept/image.hh>
38 # include <mln/border/resize.hh>
43 # define COMPRESSION_LEVEL 5
60 save_image_to_xml(std::ostream& output,
const Image<I>& ima,
63 # ifndef MLN_INCLUDE_ONLY
67 save_image_to_xml(std::ostream& output,
const Image<I>& ima_,
70 mln_trace(
"scribo::io::xml::internal::save_image");
72 mln_precondition(
exact(ima_).is_valid());
73 const I& ima =
exact(ima_);
75 output <<
"<" << qname
76 <<
" height=\"" << ima.domain().height()
77 <<
"\" width=\"" << ima.domain().width() <<
"\">"
82 seps64 = QByteArray::fromRawData((
const char *)ima.buffer(),
83 ima.nelements() *
sizeof(mln_value(I)));
84 seps64 = qCompress(seps64, COMPRESSION_LEVEL);
85 seps64 = seps64.toBase64();
87 output.write(seps64.data(), seps64.size());
89 output <<
"]]></" << qname <<
">" << std::endl;
93 # endif // ! MLN_INCLUDE_ONLY
103 # undef COMPRESSION_LEVEL
105 #endif // ! SCRIBO_IO_XML_INTERNAL_SAVE_IMAGE_TO_XML_HH