NO

Author Topic: WIC tests  (Read 5627 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
WIC tests
« on: November 03, 2022, 02:11:11 PM »
This silly example enums WIC codecs
Second zip use msvcrt.dll and print GUID too.

same example here:
http://masm32.com/board/index.php?topic=10465.msg115361#msg115361
May the source be with you

Offline John Z

  • Member
  • *
  • Posts: 860
Re: WIC tests
« Reply #1 on: November 04, 2022, 01:10:28 PM »
Very nice!  I was not aware WebP and WMPhoto has support.  Too bad these are probably not back ported to WIn 7 ...
One ends up using the older codecs to maintain compatibility.  RAW support is interesting too as I have been using Sony RAW software ...

C:\Users\John\Downloads\Pelles>WICImagingFactoryTest.exe
BMP Decoder     {6B462062-7CBF-400D-9FDB-813DD10F2778}
GIF Decoder     {381DDA3C-9CE9-4834-A23E-1F98F8FC52BE}
ICO Decoder     {C61BFCDF-2E0F-4AAD-A8D7-E06BAFEBCDFE}
CUR Decoder     {22696B76-881B-48D7-88F0-DC6111FF9F0B}
JPEG Decoder    {9456A480-E88B-43EA-9E73-0B2D9B71B1CA}
PNG Decoder     {389EA17B-5078-4CDE-B6EF-25C15175C751}
TIFF Decoder    {B54E85D9-FE23-499F-8B88-6ACEA713752B}
DNG Decoder     {981D9411-909E-42A7-8F5D-A747FF052EDB}
WMPhoto Decoder {A26CEC36-234C-4950-AE16-E34AACE71D0D}
DDS Decoder     {9053699F-A341-429D-9E90-EE437CF80C73}
Microsoft HEIF Decoder  {E9A4A80A-44FE-4DE4-8971-7150B10A5199}
Microsoft Webp Decoder  {7693E886-51C9-4070-8419-9F70738EC8FA}
Microsoft Raw Image Decoder     {41945702-8302-44A6-9445-AC98E8AFA086}
Microsoft Camera Raw Decoder    {5FDD51E2-A9D0-44CE-8C8D-162BA0C591A0}

Thanks,
John Z

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: WIC tests
« Reply #2 on: November 04, 2022, 01:16:02 PM »
Code: [Select]
Microsoft HEIF Decoder  {E9A4A80A-44FE-4DE4-8971-7150B10A5199}
Microsoft Webp Decoder  {7693E886-51C9-4070-8419-9F70738EC8FA}
Microsoft Raw Image Decoder     {41945702-8302-44A6-9445-AC98E8AFA086}
Was MS Office installed ?
Those don't belong to basic Windows 10
« Last Edit: November 04, 2022, 01:29:59 PM by TimoVJL »
May the source be with you

Offline John Z

  • Member
  • *
  • Posts: 860
Re: WIC tests
« Reply #3 on: November 04, 2022, 01:21:05 PM »
Windows 11., 21H2.

But yes Office 2010 is installed.  I'll try on another Win11 system that does not have MSOffice, it has LibreOffice and try a Win 10 system that MS keeps trying to upgrade but always fails....  ;D and a windows 7 system  :) :) :)

John Z


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: WIC tests
« Reply #4 on: November 04, 2022, 01:31:43 PM »
« Last Edit: November 04, 2022, 03:02:27 PM by TimoVJL »
May the source be with you

Offline John Z

  • Member
  • *
  • Posts: 860
Re: WIC tests
« Reply #5 on: November 04, 2022, 02:24:47 PM »
Yeah, I can't really tell with Windows 11, I have a system w/o Office BUT it does have standalone Outlook 2021 which is part of office and that shows all ....

Windows 10 1H22 which MS seems can't upgrade correctly has Office 2010 and has all of the above codecs so Office 2010 is likely the provider

Windows 7 home premium with Office 2003 only has the basics plus WMPhoto, so newer Office packages but not older ones.
I tried this, but didn't work :(
https://insider.office.com/fi-fi/blog/add-webp-images-to-office-creations
Worked on my Win 11 with Office 2010...

John Z

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: WIC tests
« Reply #6 on: November 05, 2022, 01:53:30 PM »
MS products can always use mswebp.dll as they wish, as it is WIC dll component.

Simple code to test WIC with file
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ole2.h>
#include <wincodec.h>
#include <stdio.h>
#include <wchar.h>

#pragma comment(lib, "ole32")
//#pragma comment(lib, "windowscodecs.lib")
const GUID CLSID_WICImagingFactory = {0xcacaf262,0x9370,0x4615,{0xa1,0x3b,0x9f,0x55,0x39,0xda,0x4c,0xa}};
//const GUID CLSID_WICImagingFactory1 = {0xcacaf262,0x9370,0x4615,{0xa1,0x3b,0x9f,0x55,0x39,0xda,0x4c,0xa}};
//const GUID CLSID_WICImagingFactory2 = {0x317d06e8,0x5f24,0x433d,0xbd,0xf7,0x79,0xce,0x68,0xd8,0xab,0xc2};
const IID IID_IWICImagingFactory = {0xEC5EC8A9,0xC395,0x4314,{0x9C,0x77,0x54,0xD7,0xA9,0x35,0xFF,0x70}};


int __cdecl wmain(int argc, wchar_t **argv)
{
HRESULT hr;
IWICImagingFactory *pIWICFactory = 0;
IWICBitmapDecoder *pDecoder = 0;
IWICBitmapFrameDecode *pFrame = 0;
OleInitialize(NULL);
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void **)(&pIWICFactory));
if (pIWICFactory) {
hr = pIWICFactory->lpVtbl->CreateDecoderFromFilename(pIWICFactory, argv[1], NULL, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &pDecoder );
if (pDecoder) {
puts("pDecoder created");
pDecoder->lpVtbl->GetFrame(pDecoder, 0, &pFrame );
if (pFrame) {
puts("pFrame created");
WICPixelFormatGUID pixelFormatGUID;
WCHAR wszBuffer[256];
pFrame->lpVtbl->GetPixelFormat(pFrame, &pixelFormatGUID );
StringFromGUID2(&pixelFormatGUID, wszBuffer, 255);
wprintf(wszBuffer);
UINT nWidth = 0;
UINT nHeight = 0;
pFrame->lpVtbl->GetSize(pFrame, &nWidth, &nHeight );
wprintf(L"\n%u %u\n", nWidth, nHeight);
}
pDecoder->lpVtbl->Release(pDecoder);
}
pIWICFactory->lpVtbl->Release(pIWICFactory);
}
OleUninitialize();
return 0;
}
« Last Edit: November 08, 2022, 09:06:14 AM by TimoVJL »
May the source be with you

Offline John Z

  • Member
  • *
  • Posts: 860
Re: WIC tests
« Reply #7 on: November 09, 2022, 01:18:14 PM »
Thanks!  Works very well.
Code: [Select]
C:\Users\John\Downloads\Pelles\WIC_Test>wic_test164 Bluetooth-Controlled-Home-Automation-Circuit-diagram.gif
pDecoder created
pFrame created
{6FDDC324-4E03-4BFE-B185-3D77768DC904}
1172 626

C:\Users\John\Downloads\Pelles\WIC_Test>wic_test164 9_days_in_SanJose_7_b.jpg
pDecoder created
pFrame created
{6FDDC324-4E03-4BFE-B185-3D77768DC90C}
2448 3264

Good example of how to initialize WIC too.  Might be incentive for me to investigate WIC capabilities more...

John Z