Page 1 of 1

Magic++ Draw on a TIFF image and output as a TIFF

Posted: 2007-06-13T14:35:47-07:00
by nthaha
Hello,

I am trying to draw text on a TIFF image and save it. But I cannot open the file on windows, I can open it using ImageMagic Display but not with anyother image viewer. See code below....

#include <Magick++.h>
#include <string>
#include <iostream>

using namespace std;
using namespace Magick;

int main( int /*argc*/, char ** argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);

try {
Image button;

char input[] = "1775899A.tif";
button.read(input);

std::list<Magick::Drawable> drawList;
drawList.push_back(DrawablePointSize(30));
drawList.push_back(DrawableText(150, 100, "NAUSHAD THAHA"));
button.draw(drawList);

button.write("1775899A_NT.TIF");
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}

return 0;
}

Re: Magic++ Draw on a TIFF image and output as a TIFF

Posted: 2007-06-13T14:49:53-07:00
by magick
The TIFF being created is fine, Windows most likely only supports a subset of the TIFF image specification. Try adding
  • button.matte(false);
    button.depth(8);
just before you write the image.

Re: Magic++ Draw on a TIFF image and output as a TIFF

Posted: 2007-06-13T15:00:25-07:00
by nthaha
Hello,

Thanks a lot its working now but now the image size expanded from 127KB to 469KB. I am using LWZ as my compression because with Group4 it was going up to like 600KB. Any tips to bring it back down to like 200KB would be helpfull...

Thanks again
nthaha