-5

I am looking for a method to convert JPEG images to TIFF format then keep this TIFF image in base64 format. The solution can be in C, C++ or objective C ... Please advise Thanks in advance

andand
  • 17,134
  • 11
  • 53
  • 79
batwadi
  • 1,836
  • 7
  • 29
  • 42
  • In case you didn't notice yet, this is not a demand and supply website, Tell us what you have done about the problem and we will help you depending on your approach – Alok Save Aug 16 '11 at 15:12
  • Sorry for the confusion .. i was able to encode the Jpeg image into base64 format .. now i need to convert the same into tiff base64 format.. if you want i can post the code as well – batwadi Aug 16 '11 at 15:17
  • You need to read this, [Writing the perfect Question](http://msmvps.com/blogs/jon_skeet/archive/2010/08/29/writing-the-perfect-question.aspx) – Alok Save Aug 16 '11 at 15:20

2 Answers2

5

I've used ImageMagick before and it works well. I used RMagick, the bindings for Ruby, but they have C++ bindings too. As far as keeping the tiff image in base64 format, you'll want another library like libb64. The ImageMagick piece should be as simple as

#include <Magick++.h> 
#include <iostream> 
using namespace std; 
using namespace Magick;

int main(int argc,char **argv) 
{ 
  Image image;
  try { 
    image.read( "girl.jpg" );

    // convert to tiff
    image.write( "girl.tiff" ); 
  } 
  catch( Exception &error_ ) 
    { 
      cout << "Caught exception: " << error_.what() << endl; 
      return 1; 
    } 
  return 0; 
}

(Example modified from http://www.imagemagick.org/Magick++/Image.html)

To accomodate the in memory requirement, easy enough.

Image jpg = Image("/path/to/jpg");
jpg.magick("tiff");
Blob blob;
jpg.write(&blob);

I'll let you do the work of seeing how you'll get the bytes from the blob.

I82Much
  • 26,901
  • 13
  • 88
  • 119
0

libgd or ImageMagick should do the trick.

Johni
  • 2,933
  • 4
  • 28
  • 47