Commit ca4c5986 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Fix io magick save.

	* milena/mln/io/magick/save.hh (get_colo): Magic fix.
	* milena/tests/io/magick/save.cc: Update.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@4149 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 62b2f613
2009-06-15 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Fix io magick save.
* milena/mln/io/magick/save.hh (get_colo): Magic fix.
* milena/tests/io/magick/save.cc: Update.
2009-06-14 Roland Levillain <roland@lrde.epita.fr>
Strip more files from the distribution of Milena.
......
......@@ -31,7 +31,7 @@
/// Define a function which saves an image of kind magick with
/// given path.
///
/// FIXME: there seems to be roundness errors while computing rgb values.
/// \todo At the moment it works; is it a miracle?
# include <mln/core/image/image2d.hh>
# include <mln/metal/equal.hh>
......@@ -71,15 +71,15 @@ namespace mln
inline
Magick::Color get_color(const value::int_u8& value)
{
return Magick::ColorGray(value / (double)256.0f);
return Magick::ColorGray(256 - value);
}
inline
Magick::Color get_color(const value::rgb8& value)
{
return Magick::ColorRGB(value.red() / (double)256.0f,
value.green() / (double)256.0f,
value.blue() / (double)256.0f);
return Magick::ColorRGB(256 - value.red(),
256 - value.green(),
256 - value.blue());
}
template <typename I>
......
......@@ -27,24 +27,30 @@
#include <mln/io/magick/load.hh>
#include <mln/io/magick/save.hh>
#include <mln/io/ppm/load.hh>
#include <mln/io/ppm/save.hh>
#include <mln/data/compare.hh>
#include "tests/data.hh"
#include <mln/io/magick/load.hh>
#include "tests/data.hh"
int main()
{
using namespace mln;
point2d p(0,0);
image2d<value::rgb8> lena_mln;
io::ppm::load(lena_mln, MLN_IMG_DIR "/tiny.ppm");
value::rgb8 c = lena_mln(p);
io::magick::save(lena_mln, "tiny.png");
image2d<value::rgb8> lena_im;
io::magick::load(lena_im, "tiny.png");
mln_assertion(lena_im(p) == c);
io::ppm::save(lena_im, "tiny.ppm");
mln_assertion(lena_im.domain() == lena_mln.domain());
mln_assertion(lena_im == lena_mln);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment