Convert raw to tiff file

Convert raw to tiff file

Post by Jian-Shen Lin[MSF » Tue, 25 Feb 2003 12:09:34

You can try to use GDI +

Writing Metadata to a File
To write an item of metadata to an Image object, initialize a PropertyItem
object and then pass the address of that PropertyItem object to the
SetPropertyItem method of the Image object.

The following console application writes one item (the image title) of
metadata to an Image object and then saves the image in the disk file
FakePhoto2.jpg. The main function relies on the helper function
GetEncoderClsid, which is shown in the topic Retrieving the Class
Identifier for an Encoder.

Hide Example

#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;
INT main()
   // Initialize <tla rid="tla_gdiplus"/>.
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
   Status stat;
   CLSID  clsid;
   char   propertyValue[] = "Fake Photograph";
   Bitmap* bitmap = new Bitmap(L"FakePhoto.jpg");
   PropertyItem* propertyItem = new PropertyItem;
   // Get the CLSID of the JPEG encoder.
   GetEncoderClsid(L"image/jpeg", &clsid);
   propertyItem->id = PropertyTagImageTitle;
   propertyItem->length = 16;  // string length including NULL terminator
   propertyItem->type = PropertyTagTypeASCII;
   propertyItem->value = propertyValue;
   stat = bitmap->Save(L"FakePhoto2.jpg", &clsid, NULL);
   if(stat == Ok)
      printf("FakePhoto2.jpg saved successfully.\n");

   delete propertyItem;
   delete bitmap;
   return 0;


Best Regards

Jian Shen
This posting is provided "AS IS" with no warranties, and confers no rights.