Thema: Delphi How to work with WIC?

Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

How to work with WIC?

  Alt 3. Feb 2010, 13:08
Today I discover new technology called WIC, but I not found any examples how to work with it I only researched how to load picture and convert format:

Delphi-Quellcode:
// Function() to test if this engine working correctly
function WICImageFormatDescription(const WIC: TWICImage): string;
begin
  Result := '';

  case WIC.ImageFormat of
    wifBmp: Result := 'Bitmap';
    wifPng: Result := 'PNG';
    wifJpeg: Result := 'JPEG';
    wifGif: Result := 'GIF';
    wifTiff: Result := 'TIFF';
    wifWMPhoto: Result := 'JPEG XR';
    wifOther:
    begin
      if GUIDToString(WIC.EncoderContainerFormat) = GUIDToString(GUID_ContainerFormatIco) then
        Result := 'Icon'
      else
        Result := 'other'
      ;
    end;
  end;
end;

var
  WIC: TWICImage;
begin
  WIC := TWICImage.Create;
  try
    if OpenPictureDialog.Execute then
    begin
      WIC.LoadFromFile(OpenPictureDialog.FileName);
      Image.Picture.Assign(WIC);
      ShowMessage(WICImageFormatDescription(WIC));
      WIC.ImageFormat := wifWMPhoto;
      WIC.SaveToFile('output.wdp');
    end;
  finally
    WIC.Free;
  end;
end;
For example how to get installed codecs (names and extensions, eg. to add format to dialogs). Or how to get some info about format and manipulate format during file saving? Or manipulate image? Do you have some experience with this? This looks to be good method to read RAW images.

PS: Is there better method to compare GUIDs than I wrote?
PS2: Do you know native Delphi libs to support image formats? Something like GraphicsEe, but updated to latest format versions (GrEx for example can't read last TIFFs).
  Mit Zitat antworten Zitat